Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The answer that is marked as right now (14 Oct 2014) is not the right answer at all.</p> <p>This is the only right solution:</p> <pre><code>namespace XXX\UserBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity * @ORM\Table(name="User_User") * @ORM\Entity(repositoryClass="UserRepository") * @UniqueEntity(fields="usernameCanonical", errorPath="username", message="fos_user.username.already_used") * @ORM\AttributeOverrides({ * @ORM\AttributeOverride(name="email", column=@ORM\Column(type="string", name="email", length=255, unique=false, nullable=true)), * @ORM\AttributeOverride(name="emailCanonical", column=@ORM\Column(type="string", name="email_canonical", length=255, unique=false, nullable=true)) * }) */ class User extends BaseUser { ... } </code></pre> <p>Also you need to override validation groups for your user form:</p> <pre><code># app/config/config.yml ... fos_user: profile: form: validation_groups: [Default] # Here you can also add your own groups if you have extra validation registration: form: validation_groups: [Default] # Here you can also add your own groups if you have extra validation </code></pre> <p>What did we do? We just overrode validation groups to not match the FOS default validations. Instead your form will be validated only with <code>Default</code> group. Described above validation <code>UniqueEntity</code> that doesn't have any group will be matched by <code>Default</code> group.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload