[TYPO3-mvc] How to extend a model class from within another extension?

Franz Koch typo3.RemoveForMessage at elements-net.de
Sun Jan 17 13:13:02 CET 2010


Hi Thomas,

> For better understanding I want to get more into detail.
...
> $this->productRepository =
> t3lib_div::makeInstance('Tx_ExtOld_Domain_Repository_ProductRepository');
>
> And in my oppinion, this repository SHOULD return the NEW model objects
> of which the class is defined in ExtNew (Tx_ExtNew_Domain_Model_Product),
> which is NOT the case - it will always return the 'old' model.
>
> So, I'm wondering if it is possible to tell Extbase to take the new class?!

As far as I have seen from the source it's not possible - and that's a 
big issue I think. Imagine Typo3 would run on extbase, you would not be 
able to extend tt_content or pages in any way.
Although it would be possible for extbase to remap the classes according 
to some TS configuration (you would have to implement this in 
DataMapper->createEmptyObject I think), it might still not work in any 
way, because of all the type declarations used all over the code, f.e. 
"function setFoo(Tx_ExtOld_Domain_Model_Foo $foo)" which will throw a 
error if a model Tx_ExtNew_Domain_Model_Foo is passed to it. So from my 
point of view magic getters/setters are needed or some fancy magic 
service implementing getters/setters on the fly by rewriting classes 
according to some TS configuration etc.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list