[FLOW3-general] Mapping and adding objects - problem with properties

Ferdinand Kuhl fcool at coolys.de
Wed Aug 31 10:15:34 CEST 2011


*argh*
Sorry Dawid. I think I found your problem:

Compare your date with your given format. In your initialize you define the 
date:

\TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT, 
'd.m.Y'

And in the form you enter:

10-05-2011

(which would be "d-m-Y")

So adjust your Format-String in the TypeConverter or try:
10.05.2011

Greetz,
Ferdinand

Dawid Pacholczyk wrote:

> 1) No, I did not forget about setter. I have both, setter and getter for
> this field. Setter is set as public
> 
> 2) I`ve found 2 days ago. I used the same example. I`ve changed only
> fields name.
> 
> That`s why I`m looking for help
> 
> Best regards,
> Dawid Pacholczyk
> 
> W dniu 2011-08-31 01:59, Ferdinand Kuhl pisze:
>> Hi Dawid,
>>
>> for your problem with Datetime search the newsgroup. Mathis had the same
>> problem.
>>
>> Search for "DateTime and FLUID-Form".
>>
>> Greetings,
>> Ferdinand
>>
>> Dawid Pacholczyk wrote:
>>
>>> Hello List,
>>>    I have problem with mapping or maybe with adding nested models and
>>> DateTime
>>>
>>> 1. I have user model that is associated with address model. Address has
>>> 3 fields that are not properties of user. How can I create *one* form
>>> where I can add properties of user and address with out exception ? How
>>> should I fetch data ?
>>>
>>> 2. I can convert string to DateTime object. I have
>>>
>>> /**
>>> * Users birthdate
>>> *
>>> * @var \DateTime
>>> * @Column(type="date")
>>> */
>>> protected $birthdate;
>>>
>>> <f:form.textbox property="birthdate" id="birthdate" />
>>>
>>> /**
>>> * Initialize createAction
>>> *
>>> * @return void
>>> */
>>> public function initializeCreateAction() {
>>>
>>> $this->arguments['newUser']->getPropertyMappingConfiguration()-
>>> forProperty('birthdate')-
>>> 
setTypeConverterOption('TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter',
>>>
>>>
>> 
\TYPO3\FLOW3\Property\TypeConverter\DateTimeConverter::CONFIGURATION_DATE_FORMAT,
>>> 'd.m.Y');
>>> }
>>>
>>>
>>> But I keep getting exception
>>>
>>> #1297759968: Exception while property mapping at property path
>>> "birthdate":The string"10-05-2011" could not be converted to DateTime
>>> with format "d.m.Y"
>>>
>>> What am I doing wrong ?
>>>
>>> Best regards,
>>> Dawid Pacholczyk
>>



More information about the FLOW3-general mailing list