symfony - Remove all validation constraints in child class properties -
i have problem clearing validation constraint extend super class. below code
user.php
* @var string * @orm\column(type="text", unique=true) * @assert\notblank() * @assert\notnull() * @adminassert\mycustomvalidation */ protected $phonenumber;
in admin.php wrote code below
class admin extends user
* @var string * @orm\column(type="text", unique=true) */ protected $phonenumber;
i want remove validation constraints can't remove it.
for disabling validation of form can set validation_groups
option false
, described here in doc.
in case can check class data (as described here in doc) disabling or not form validation, example:
public function configureoptions(optionsresolver $resolver) { $resolver->setdefaults(array( 'validation_groups' => function (forminterface $form) { $data = $form->getdata(); if ($data instanceof admin) { return; } return array('default'); }, )); }
hovenever in code see a custom validation on admin validation, if consider use validation groups.
hope help
Comments
Post a Comment