Why is my Symfony2 @UniqueEntity constraint not working at all?
I have the following entity class in my application: <?php namespace ...; // use ... use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;; // ... /** * @ORM\Table(name="sc_user") * @ORM\Entity(repositoryClass="...\UserRepository") * @ORM\HasLifecycleCallbacks() * @UniqueEntity(fields={"email", "username"}) */ class User implements UserInterface, \Serializable, EquatableInterface { /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string $email * * @ORM\Column