[TYPO3-mvc] Complex array validation

Claus Due claus at wildside.dk
Tue Feb 7 19:18:14 CET 2012


> Sorry I didn't clarify that point... I did use the correct model class name - in this case:
> 
> if ($newInquiry === NULL) {
>  $newInquiry = $this->objectManager->create('Tx_Booking_Domain_Model_Inquiry');
> }
> 


Ah, OK. The error seems to be caused by Extbase/Fluid/FED not being able to tell which type of object to load. These are the lines causing problems:

$formObject = $this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_FormViewHelper', 'formObject');
$complexObjectType = $this->infoService->getPropertyType($formObject, $property);
$objectType = $this->infoService->parseObjectStorageAnnotation($complexObjectType);
$objectInstance = $this->objectManager->get($objectType);

Which means that possible causes for this problem are, in the order of likelyhood:

1) Missing/incorrect @var annotation on Model's property which holds the related objects. Format must be @var Tx_Extbase_Persistence_ObjectStorage<Tx_Booking_Domain_Model_Inquiry>. In which case $objectType would be incorrect. I susect the <Tx_Booking_Domain_Model_Inquiry> part is missing?

2) Form object not being available as a Fluid template variable, in which case $complexObjectType cannot be read and would be empty, causing an empty string to be returned.

If 2 is the case I would expect to see some ill effects when triggering form validation errors so I put odds in favor of 1 being the case.

--
Cheers,
Claus
http://fedext.net


More information about the TYPO3-project-typo3v4mvc mailing list