[TYPO3-mvc] Complex array validation

Jacob Rasmussen jacob at lightbulb.dk
Tue Feb 7 21:09:45 CET 2012

> 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.

I found a minor error in my Fluid template, but still haven't had any 
progress on the issue, so let my try to explain the setup in details:

My root object is Tx_Booking_Domain_Model_Inquiry which maps to 
Tx_Booking_Domain_Model_Person and Tx_Booking_Domain_Model_Wish

I'm currently using the following annotation in 

  * @var 
protected $personer;

  * @var Tx_Extbase_Persistence_ObjectStorage<Tx_Booking_Domain_Model_Wish>
protected $oensker;

AFAIK that's the right way to annotate the two submodels.
And the two properties are initialized as empty ObjectStorage models in 
the constructor.

All the getters and setters are available, so I guess the problem lies 
somewhere else.

At the moment, I'm only testing the form.group VH on $oensker, and just 
to be sure that the problem isn't due to usage of partials, I've stopped 
using partials while testing.

My controller action looks like this (the one which renders the form):

  * action new
  * @param Tx_Booking_Domain_Model_Inquiry $newInquiry
  * @dontvalidate $newInquiry
  * @dontverifyrequesthash
  * @return void
public function newAction(Tx_Booking_Domain_Model_Inquiry $newInquiry = 
   if ($newInquiry === NULL) {
     $newInquiry = 

   $this->view->assign('newInquiry', $newInquiry);

And finally the template...

{namespace fed=Tx_Fed_ViewHelpers}
<f:layout name="Default" />
   <f:section name="main">
     <f:form class="clearfix" method="post" action="create" 
enctype="multipart/form-data"  name="newInquiry" object="{newInquiry}">
       <fed:form.group amount="1" property="newInquiry.oensker" 
         <f:form.textfield property="{property.fraDato.name}" 
class="calendar" />

And according to the stack trace (a bit further down from my last 
exerpt... the right model is used).

Tx_Fluid_ViewHelpers_FormViewHelper::render("create", array, NULL, NULL, 
NULL, NULL, Tx_Booking_Domain_Model_Inquiry, 0, boolean, boolean, "", 
"", array, boolean, boolean, array, NULL, NULL, NULL)

Sorry for the line endings, but it seems that Thunderbird really loves 
to wrap lines at 76 chars - good old RFC :)

Kind regards

Jacob Rasmussen
Certified TYPO3 Integrator

More information about the TYPO3-project-typo3v4mvc mailing list