Skip to content

Instantly share code, notes, and snippets.

@CharlyPoppins
Created April 29, 2015 09:51
Show Gist options
  • Save CharlyPoppins/9809c6cd43da01480cd9 to your computer and use it in GitHub Desktop.
Save CharlyPoppins/9809c6cd43da01480cd9 to your computer and use it in GitHub Desktop.
@ UniqueEntity
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;
use Knp\DoctrineBehaviors\Model as ORMBehaviors;
/**
* @ORM\Table("Test")
* @ORM\Entity(repositoryClass="Charly\TestBundle\Entity\TestRepository")
* @ORM\HasLifecycleCallbacks
* @UniqueEntity("reference")
*/
class Test
{
/**
* @Assert\NotBlank()
* @ORM\Column(type="string", length=255, unique=true)
*/
private $reference;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment