Feature #64842
Validation of Property should also happen before Property Mapping.
Status: | New | Start date: | 2015-02-04 | |
---|---|---|---|---|
Priority: | Could have | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | - | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No |
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) {