validation - Validate datetime in Symfony2 -
i trying validate posted datetime string getting generic error "error: value not valid". data posted on restful api (if makes difference).
validation constraints through annotations in entity:
/** * @var \datetime * * @orm\column(name="created_at", type="datetime", nullable=true) * @assert\datetime(message="createdat must valid datetime string") */ private $createdat;
controller code processing form
$user = new user(); $form = $this->createform(new usertype(), $user); $form->submit($request); if ($form->isvalid()) {..}
if field not passed validation works.
Comments
Post a Comment