[TYPO3-mvc] Casting objects

Xavier Perseguers typo3 at perseguers.ch
Wed Jul 8 08:21:35 CEST 2009


Hi,

> Is there some official and more important working way of casting objects 
> when using Extbase?
> 
> I have a class B (in extension FooBar) extending class A (from extension 
> Foo).
> 
> I only want to extend it for my own purpose in EXT:FooBar, thus no use 
> of XCLASS.
> 
> Now, I have to override a few methods such as FindOneBy... in order to 
> return a class B object instead of class A. What should I do?

Another solution would be in castToClass to use reflection to get 
properties and then play with method _reconstituteProperty() for each of 
them and end with a call to _memorizeCleanState() before returning the 
casted object but perhaps there is still another more straightforward way?

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-project-typo3v4mvc mailing list