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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -