I'm using Symfony 2.1 for a project. I use SonataAdminBundle for administration usage. i want to add an assert to my slug property in my admin class.. how can i do this?
in my entity i had set the assertion but it seems that it doesn't work here :(
related codes: the entity :
/*
* @ORM\Table(name="default_doctor_specialty")
* @UniqueEntity("uniqueSlugName")
* @ORM\Entity
*/
class Test {
//..
/**
* @var string
* @Gedmo\Slug(fields={"name"},unique=false)
*
* @ORM\Column(name="unique_slug_name", type="string", length=255, nullable=false , unique=true)
*/
private $uniqueSlugName;
}
in admin class:
class TestAdmin extends Admin {
protected $formOptions = array(
'validation_groups' => 'Default'
);
//...
}
why the default validation doesn't work???
& even if doesn't work like this how can i set the unique validation inside admin class ???
thanks for your answers :)