[FLOW3-general] Mapping and adding objects - problem with properties
Ferdinand Kuhl
fcool at coolys.de
Wed Aug 31 01:57:21 CEST 2011
Hi David,
you probably forgot to create a setter. There have to be function called:
setBirthdate($birthdate) {
$this->birthdate = $birthdate;
}
Greetz,
Ferdinand
Dawid Pacholczyk wrote:
> About point 1
>
> I`ve managed to get exception
> #1297759968: Exception while property mapping at property path
> "":Property "birthdate" could not be set in target object of type
> "My\Package\Domain\Model\User"
>
> When I change this attribute to public it works. Is it good ? Or am I
> missing something ?
>
> Best regards,Dawid Pacholczyk
>
> W dniu 2011-08-30 21:10, Dawid Pacholczyk pisze:
>> 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