[TYPO3-mvc] non-db based value objects and embedded values - how to?

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jun 3 13:24:07 CEST 2010


Hi Masi,

> Or how to extend the data mapper? As I perceive it the data mapper is currently limited to scalars
> and object relations. Even value objects are treated as relations in as much as Extbase supports
> AFAIK only value objects which values are based on a DB table.
>
> I have tried to represent a TCA select field with fixed values (defined in the TCA as array) as a
> value object (with a factory). But other value objects can be imagined, the DateTime object used by
> Extbase itself is such an example.
>
> A solution I can imagine is that whenever the data mapper processes a property that isn't a scalar
> it will look for a factory class. If found it will use it, if not it will proceed as as usual (and
> restore the object).
>
> An alternative solution could be to add a new configuration option to the persistence configuration
> is TS. I see three options:
...

if I got you right, you like to have extbase map a property to any 
class/object you define in the doc comment, as it's currently limited to 
objects based on DB relations and DateTime only. I can only second that. 
For me, a straight forward solution would be to stay with the @var 
annotation and let extbase do the magic in the background - no TS hassle 
(although TS would allow more flexibility to "hack" foreign extensions 
in v4). Using a factory if available also sounds good to me - 
alternatively a "@factory Tx_MyExt_MVC_Objects_TCASelect" annotation 
could be used instead of @var - but I'd favor to stay with @var.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list