title: Symfony2 UniqueEntity validation error with entity inheritance
body: <p>I have a patner, a buyer and an admin class that inherit a user class</p>
  
  <p>When I want to add a partner, the validator do not work</p>
  
  <pre><code> * @DoctrineAssert\UniqueEntity(fields="username", message="Ce nom d'utilisateur est déjà utilisé, veuillez en choisir un autre.", groups={"registration", "account"})
   * @DoctrineAssert\UniqueEntity(fields="mail", message="Cette adresse mail est déjà utilisé, veuillez en choisir un autre.", groups={"registration", "account"})
  </code></pre>
  
  <p>If I choose a username to a "partner" that is already in database, it shows me the right validation error. But if I choose the username of a "buyer" which is already in the database, there is no verification, and have a unique field error in my databases.</p>
  
  <p>Class User</p>
  
  <pre><code>&lt;?php
  
  namespace Antho\Test\CoreBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
  use Symfony\Component\Security\Core\User\UserInterface;
  use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
  
  /**
   * Antho\Test\CoreBundle\Entity\User
   *
   * @ORM\Table(name="user")
   * @ORM\Entity(repositoryClass="Antho\Test\CoreBundle\Entity\UserRepository")
   * @ORM\InheritanceType("SINGLE_TABLE")
   * @ORM\DiscriminatorColumn(name="type", type="string")
   * @ORM\DiscriminatorMap({"user" = "User", "partner" = "Partner", "buyer" = "Buyer", "admin" = "Admin"})
   * @ORM\HasLifecycleCallbacks()
   * @DoctrineAssert\UniqueEntity(fields="username", message="Ce nom d'utilisateur est déjà utilisé, veuillez en choisir un autre.", groups={"registration", "account"})
   * @DoctrineAssert\UniqueEntity(fields="mail", message="Cette adresse mail est déjà utilisé, veuillez en choisir un autre.", groups={"registration", "account"})
   */
  class User implements UserInterface
  {
      /**
       * @var integer $id
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * @var string $username
       *
       * @ORM\Column(name="username", type="string", length=255, unique=true)
       */
      private $username;
  
      /**
       * @var string $lastName
       *
       * @ORM\Column(name="last_name", type="string", length=255)
       */
      private $lastName;
  
      /**
       * @var string $firstName
       *
       * @ORM\Column(name="first_name", type="string", length=255)
       */
      private $firstName;
  
      /**
       * @var string $mail
       *
       * @ORM\Column(name="mail", type="string", length=255, unique=true)
       */
      private $mail;
  
      /**
       * @var string $password
       *
       * @ORM\Column(name="password", type="string", length=255)
       */
      private $password;
  
  
      public function __construct()
      {
          if ($this-&gt;createdAt === null) {
              $this-&gt;createdAt = new \DateTime('now');
          }
          $this-&gt;isEnabled = true;
      }
  
      public function __toString()
      {
          return $this-&gt;username;
      }
  
      GETTER and SETTER ...
  }
  </code></pre>
  
  <p>Class Partner</p>
  
  <pre><code>&lt;?php
  
  namespace Antho\Test\CoreBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
  
  /**
   * Antho\Test\CoreBundle\Entity\Partner
   *
   * @ORM\Table(name="partner")
   * @ORM\Entity(repositoryClass="Antho\Test\CoreBundle\Entity\PartnerRepository")
   */
  class Partner extends User
  {
      /**
       * @ORM\OneToMany(targetEntity="Restaurant", mappedBy="partner", cascade={"remove", "persist"})
       */
      private $restaurants;
  
      /**
       * @var string $company
       *
       * @ORM\Column(name="company", type="string", length=255)
       */
      private $company;
  
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;restaurants = new \Doctrine\Common\Collections\ArrayCollection();
          $this-&gt;isValid = false;
      }
  
      GETTER and SETTER ...
  }
  </code></pre>
  
  <p>Class Buyer</p>
  
  <pre><code>&lt;?php
  
  namespace Antho\Test\CoreBundle\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  use Symfony\Component\Validator\Constraints as Assert;
  use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
  
  /**
   * Antho\Test\CoreBundle\Entity\Buyer
   *
   * @ORM\Table(name="buyer")
   * @ORM\Entity(repositoryClass="Antho\Test\CoreBundle\Entity\BuyerRepository")
   */
  class Buyer extends User
  {
      /**
       * @var string $address
       *
       * @ORM\Column(name="address", type="string", length=255)
       */
      private $address;
  
      /**
       * @var string $city
       *
       * @ORM\Column(name="city", type="string", length=255)
       */
      private $city;
  
      /**
       * @var string $zip
       *
       * @ORM\Column(name="zip", type="string", length=255)
       */
      private $zip;
  
      /**
       * @var boolean $newsletter
       *
       * @ORM\Column(name="newsletter", type="boolean")
       */
      private $newsletter;
  
  
      public function __construct()
      {
          parent::__construct();
          if ($this-&gt;newsletter === null) {
              $this-&gt;newsletter = false;
          }
      }
  
      GETTER and SETTER ...
  }
  </code></pre>