[TYPO3-mvc] Chaining: Return Domain Model Object in Setter Methods

Sebastian Michaelsen sebastiangebhard at hoch2.de
Tue Sep 7 13:40:00 CEST 2010


Hey,

most of you probably know that returning the object itself ($this) in 
its setter gives you the possibility to chain methods like:

$me = new User();
$me->setName('Sebastian')->setGender('Male');

I wanted to ask if there is any specific reason why this is not 
"enabled" in extbase. When I take Tx_Extbase_Domain_Model_FrontendUser 
as an example the setters do not return anything.

I'm asking because there's a feature request 
(http://forge.typo3.org/issues/9628) for the extbase_kickstarter for 
exactly this behaviour. It's not implemented yet, because I did not see 
it as "common" in extbase and extbase'd extensions like blog_example.

Kind regards,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list