[TYPO3-mvc] Extbase Property Mapper doesn't handle DateTime yet

Jochen Rau jochen.rau at typoplanet.de
Tue Nov 17 23:18:02 CET 2009


Hi Stephan.

Stephan Reuther - development.IT wrote:
> i just recognized that the Property/Mapper doesn't handle DateTime objects.
> setting a model's property via fluid form which is defined as DateTime
> will throw an exception: "Argument 1 passed to
> Tx_MyExt_Domain_Model_Order::setOrderDate() must be an instance of
> DateTime, string given"
> DateTime is a special data type. Not plain and no Domain Model (with at
> least one "_"). So it should get it's own handling.
> i checked the bug tracker at forge but didn't found this
> bug/missing_feature already reported.
>
> or am i on the wrong way and there is a much easier solution for
> dateTime objects set via fluid form data?

You are right. That's because the property mapper was taken from FLOW3. 
And in FLOW3 there will be a more general concept of property editing 
available in the future (AFAIK). But it can also be a bug.

I have implemented a simple string to DateTime mapping in Extbase now. 
It should also work, if you have your own DateTime class extending the 
one from PHP.

The string entered in the form field is directly passed to the DateTime 
constructor. Thus, all of the following strings should work:

2.10.2009
2009-11-17
now +1 week
today
next Monday

Regards
Jochen

-- 
Every nit picked is a bug fixed



More information about the TYPO3-project-typo3v4mvc mailing list