[TYPO3-50-general] Helping Functions

Sebastian Kurfürst sebastian at typo3.org
Mon Feb 2 06:48:13 CET 2009


Hey Thomas,

> Is there currently a way so I don't need to write all this set/get
> functions?
Currently (IMHO) we require you to write all getters / setters by  
hand. In the middle-long term, there will be scaffolding for that -  
but you should do that because the domain layer should not contain any  
"magic". When Eclipse supports namespace syntax, it'll be much nicer  
to work with if you have explicit getters/setters.
If you, however, require a way to access getters/setters  
programmatically, we've created helpers in Reflection/ 
ObjectAccess.php. This is a kind of Java Beans implementation for PHP.

> I looked at Reflection\ObjectAccess and Object\Mapper but how to
> "include" this into my class?
You mean Property\Mapper, right? That is for mapping properties of one  
object to another (implicitly by calling getters/setters again). This  
is used f.e. when arguments are mapped to objects.

> I was also wondering about something Robert "showed" at the
> "Hitchhiker's Guide to FLOW3" (it's at about minute 53).
>
> -- code --
> /**
>  * @return F3\PhoneBook\Domain\PhoneBookEntry
>  */
> abstract protected function createPhoneBookEntry($key);
> -- code --
>
> this still doesn't work right? at least I get the following Error:
> <Class> contains 1 abstract method and must therefore be declared
> abstract or implement the remaining methods  
> ([...]createPhoneBookEntry)
The question is here how to create prototypes. Spring does it like  
above, this is why we have considered doing it as well. However, it  
has several drawbacks, mostly related to testing... That's why we  
create Prototype-scoped objects explicitly with objectFactory- 
 >create(...).
So, that the above does not work is not a bug nor a missing feature :-)

Greets,
Sebastian


More information about the TYPO3-project-5_0-general mailing list