Feature #64842

Validation of Property should also happen before Property Mapping.

Added by Hardik Satasiya over 6 years ago.

Status:
New
Priority:
Could have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-02-04
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

Problem :

I have relation from my model to user many to one so when i try to insert record and if i choose staff it works like charm but if i put it blank it throws me error during property mapping.

it seems its mapping argument before validating it.

As in post arguments :

momentForm[staff] = <blank> <-- throws error NULL given insted of ExtendedUser
If i remove "momentForm[staff]" then it validates the property properly.

But i can not remove "momentForm[staff]" from post if some one is not selecting anything from select box.

validation after :
initialize*Action - for manual property mapping
validation before :
and before automatic property mapping

Scenario :

template :
<f:form action="addMoment" method="post" objectName="momentForm" >
...
<f:form.select property="staff" prependOptionLabel="- select staff -" options="{staff}" optionLabelField="name" />

...

model :

@/** * @var <package-name>\Domain\Model\ExtendedUser * @Flow\Validate(type="NotEmpty") * @ORM\ManyToOne * ORM\Column(options={"comment"= "Referance to User Account"})
*/
protected $staff;

controller :
@
/** * add moment Action * * @param <package-name>\Domain\Model\<model-name> $momentForm * return void
*/
public function addMomentAction($momentForm) {

No data to display

Also available in: Atom PDF