[Flow] Validation > Exception instead of going back to newAction

Axel Wüstemann awu at qbus.de
Fri Dec 6 10:06:54 CET 2013


@Bastian Waidelich

Now I tried this:

protected function initializeCreateAction()
{
    $depositInspection = $this->request->getArgument('depositInspection');
    $depositInspection['date'] = $this->__buildDateTime();
    $this->request->setArgument('depositInspection', $depositInspection);
}

This did not work:

  It is not allowed to map property "date". You need to use 
$propertyMappingConfiguration->allowProperties('date') to enable mapping 
of this property

So I added:

$propertyMappingConfiguration = 
$this->arguments->getArgument('depositInspection')->getPropertyMappingConfiguration(); 
	$propertyMappingConfiguration->allowProperties('date');

But I don't know, why this might be nessecary. It would be great, if you 
could explain it a bit ;=)

At the end all is before: If I add again my validation rule I get:

An instance of "xx\Domain\Model\DepositInspection" failed to pass 
validation with 1 error(s): date: This property is required.

No idea, how to get it to run...

Thank you, Axel

Am 05.12.2013 19:01, schrieb Axel Wüstemann:
> Am 05.12.2013 14:29, schrieb Bastian Waidelich:
>> protected function initializeCreateAction() { $depositInspection =
>> $this->arguments->getArgument('depositInspection'); if
>> ($depositInspection !== NULL) { $depositInspection->setDate(...); }
>> }
>
>
> This unfortunately does not work because in this state
> $depositInspection ist not of type
> ...\FisheryInspection\Domain\Model\DepositInspection
> but of type
> TYPO3\Flow\Mvc\Controller\Argument
>
>
>> <f:form.textfield property="date.date" ... and <f:form.textfield
>> property="date.hour" ... <f:form.textfield property="date.minute"
>> ... and a hidden field with the expected date format: <f:form.hidden
>> property="date.dateFormat" value="dd.mm.yy" />
>
> Wouldn't this lead to the same problem: Therefor I would need a
> converter from array to datetime. This converter I would setup in the
> createAction, where the validation already was done...
>
> A bit frustating, that in the first step simple things lead to those
> complex thing.. ;=)
>
> To be honest, I don't know, what I can do now.
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow


More information about the Flow mailing list