[Flow] Persisting objects that are not Models
Christian Loock
chl at vkf-renzel.de
Wed Sep 4 16:52:01 CEST 2013
Yeah, as i thought. When I add my Class to the whitelist, my
typeconverter is being used.
Is there any good documentation on ValueObjects? When I declare my Class
as a ValueObject, it complains that it is no allowed to have setters.
What would I use an object for, that does not have any setters on it?
Am 04.09.2013 16:47, schrieb Christian Loock:
> Hi,
>
> I allready got so far and started to write a type converter. However,
> it seems like that my Property doesnt even be recognized by the class
> schema.
>
> The reason behind this, that only Entities and Value Objects, or
> Object Types that are on a White List seam to be considered by the
> reflection service.
>
> Here is the part in the ReflectionService that I mean:
>
> protected function
> addPropertiesToClassSchema(\TYPO3\Flow\Reflection\ClassSchema
> $classSchema) {
>
> // those are added as property even if not tagged with
> entity/valueobject
> $propertyTypeWhiteList = array(
> 'DateTime',
> 'SplObjectStorage',
> 'Doctrine\Common\Collections\Collection',
> 'Doctrine\Common\Collections\ArrayCollection'
> );
>
> This Whitelist is static and doesnt seem to be expandable. Which means
> I would need to declare my Object to be an Entity (which makes no
> Sense for DateIntervals) or an ValueObject (which doesnt work and I
> dont understand their purpose).
>
> This imho is really bad. Doctrine doesnt really care what type your
> fields have. You can specify a Type Object or Array and it will store
> everything. Even though i dont know why you need a whitelist at this
> point, I think havin it static in there is just bad design. It would
> have been way better to make it configurable. This way there seems to
> be no possibility to extend this functionality.
>
> Am 04.09.2013 16:30, schrieb Pankaj Lele:
>> Hi Christian,
>>
>>> I wonder if there is a way to add support to persisting Objects as
>>> field Values, like it works with the \DateTime Class. I would like
>>> to store \DateInterval Objects in a field.
>>>
>>> DateTime Objects are converted into a timestamp and i wonder where
>>> this conversion takes place and if it is possible to implement
>>> something like this for my flow packages.
>>
>> This conversion is handled by the TypeConverters of Flow here you can
>> find the required help [1]
>>
>> And for example you can have look at
>> TYPO3\Flow\Property\TypeConverter\DateTimeConverter
>>
>> [1]
>> http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/PropertyMapping.html#writing-your-own-typeconverters
>>
>>
>>
>> -Pankaj
>>
>
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list