[Flow] Validator is not called ...
Tomas M
flow at 46dev.de
Tue Mar 31 16:31:21 CEST 2015
Hello!
I have defined two classes; both are presisted in db (see code snipped below).
In the according form the user selects one "car" from a select box.
As long the user really selects one, all is fine.
But if the field is left blank I get
Exception while property mapping for target type "My\Pkg\Domain\Model\myObject", at property path "":
Catchable Fatal Error: Argument 1 passed to My\Pkg\Domain\Model\myObject_Original::setCar() must be an instance of
My\Pkg\Domain\Model\Car, null given ....
First I've used
@Flow\Validate(type="NotEmpty")
but I got exactly the same message.
My validator is called only, if a "car" was selected
else I get the message above.
What I'm doing wrong?
Does someone have an idea?
/**
* @Flow\Entity
*/
class myObject {
/**
* @var string
*
* @Flow\Validate(type="Text")
* @Flow\Validate(type="StringLength", options={ "minimum"=5, "maximum"=80 })
* ORM\Column(length=255)
*/
protected $theLabel;
/**
* @var \My\Pkg\Domain\Model\Car
* @Flow\Validate( argumentName="car", type="\My\Pkg\Validation\Validator\myObjectValidator", options={})
* @ORM\ManyToOne
*/
protected $car;
...
}
More information about the Flow
mailing list