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

Helmut Hummel helmut at typo3.org
Fri Sep 3 12:36:37 CEST 2010


Hi Franz,

Am 03.09.2010 03:24, schrieb Franz Koch:
>
> the concept sounds nice, but also has a downside, see below:
>
>> Disadvantages:
>> * The autoloader is probably not the nicest place to have this
>> functionality (however it would be possible to implement it into an
>> object manager).
>>
>> * It will be difficult to have proper error handling, giving nice errors
>> if the mixin conflicts with already defined methods or properties.
>
> that wouldn't be such a big loss compared to the benefits I think.

OK.

>> * It is not possible to override methods within a mixin (which might be
>> a bad idea anyways)
>
> I think this has to be possible via whatever approach - so the current
> concept is not yet a final solution and needs some more thoughts.
>
> Just an example. Imagine you're extending a existing extension and add
> some new properties etc. Now imagine the domain model itself contains
> some domain logic you're additions also depend on. So you need a way to
> "hook" in there.
> Or just imagine your new properties depend on another one and you
> yourself need to add domain logic to a existing setter in order to
> fulfill a dependency in your added property.
> So there definitely has to be a way to override or better extend functions.

I totally understand that usecase, but how far should we go for extbase? 
Should it be possible to call the "original" method out of the mixin 
method that overrides the original method? Should the mixin method be 
called before or after the original method? How should this be configurable?

I mean, it could perfectly be covered by the possibilities of AOP.
However I'm not willing to implement AOP for extbase and I'm also not 
sure if this would be the way to go.

So the question is, do we want the solution I advertised and benefit 
from it as far as it goes (beeing able to _add_ functionality and 
properties), or leave it as is and wait until a better solution is in 
place or FLOW3 stable is released.

If we'd decide to go with the proposed solution, it could be extended in 
a _second_ step, allowing all trait possibilities, that were added to 
the PHP trunk[1]. This would allow to configure to override or even 
rename methods for the resulting object, yet it for sure would still not 
cover all possible usecases.

OK, it's up to you (the community and the extbase makers) to decide.

Regards Helmut

[1]http://wiki.php.net/rfc/horizontalreuse


More information about the TYPO3-project-typo3v4mvc mailing list