[FLOW3-general] Subproperties not recognized

Steffen Wickham steffen at gaming-inc.de
Mon Jul 23 16:10:17 CEST 2012


Hi there,

while development I found a strange behaviour when I try to create a
model with references to other models via forms and hope somebody can
explain me what's wrong... :-/

I have a domain model called "Referee" with references to
\TYPO3\Party\Domain\Model\Person called "person" (mapped OneToOne,
validate NotEmpty) and \AFSVN\Base\Domain\Model\Address called "address"
(mapped ManyToOne unidirectional, no validation) beside some string and
\DateTime values. My "Address" model consists of string values without
validation at the moment. The model is annotated with @FLOW3\Entity.

I've created a normal form with fluid viewhelpers for my new/create
action and named the fields like "person.name.firstName" and
"address.zip" (according the fluid syntax and model structure). In my
initializeCreateAction function of the corresponding ActionController
I've set target type for both variables and allowed to create them. Here
is my code ("newReferee" is the name of the form):

$this->arguments['newReferee']->getPropertyMappingConfiguration()->setTargetTypeForSubProperty('person',
'\TYPO3\Party\Domain\Model\Person');
$this->arguments['newReferee']->getPropertyMappingConfiguration()->setTargetTypeForSubProperty('address',
'\AFSVN\Base\Domain\Model\Address');

$this->arguments['newReferee']->getPropertyMappingConfiguration()->allowCreationForSubProperty('person');
$this->arguments['newReferee']->getPropertyMappingConfiguration()->allowCreationForSubProperty('address');



When I try to create a new Referee it would create the new person entity
and save them with the referee object to the database. Just the address
model wouldn't be created and saved anyway.
I've intercepted the request after the code lines shown before and
wondered about the arguments send by the form: The address data seems to
be not recognized as property of Referee by FLOW3. Please have a look at
the screenshot "ArgumentsDeliveredByForm.png" attached. All address data
would be send by the form like "address_street" and "address_zip".

So I took a deeper look at the Property Mapping (please have a look at
PropertyMapping.png attached). FLOW3 recognize my configuration for
subproperties but doesn't map it to my Referee model.

I would be very happy when someone can give me a hint, why my Address
model couldn't be mapped and how I can fix it?!

Many thanks
Steffen


More information about the FLOW3-general mailing list