[TYPO3-mvc] Proposal: mixed-ins for extbase

Sebastian Kurfürst sebastian at typo3.org
Mon Sep 6 08:51:51 CEST 2010


Hey Franz and Helmut,

with Helmut's ideas, it will be possible to access methods of the base
class inside the mixins, so you can interact with values and/or methods
in other mixins, i.e. call them or read out their values.

So, while it is not possible to *override* methods from the start, it is
possible to work around this problem: Imagine the following:

// in abstract model "User"
// $name with getters and setters

// Now, I want to provide a mixin which extends "setName" with the
saltation (Mr. or Mrs.), so I need an additional field:

$saltation
public function getNameWithSaltation() {
	return $this->saltation . $this->getName();
}

So, when creating a mixin, one usually also controls the Fluid Template
where the mixed-in object is shown, and can thus use the modified
accessors instead of the original ones, so instead of doing {user.name},
one needs to do {user.nameWithSaltation}.

I agree that's not as nice as f.e. using AOP, but it is a pragmatic
solution which brings us 85% of the way.

So, +1 for implementing Helmut's Idea, and possibly extending it lateron.

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list