getEntityBy("App:Group","label",$value); if($tmp) $form->addError(new FormError('Un groupe utilise déjà ce label')); $tmp=$this->getEntityBy("App:Niveau02","label",$data->getLabel()); if($tmp) $form->addError(new FormError('Un niveau de rang 02 utilise déjà ce label')); */ // On s'assure que le label ne contient pas des caractères speciaux $string = preg_replace('~[^ éèêôöàïî\'@a-zA-Z0-9._-]~', '', $value); if ($string != $value) { $this->context->addViolation($constraint->message); } } }