What do I have to enter in the annotation of a doctrine entity.
Its actually like this...
/**
* @ORM\Column(type="string", length=255)
*
* @Assert\Length(
* min=3,
* max=255,
* minMessage="The name is too short.",
* maxMessage="The name is too long.",
* groups={"Registration", "Profile"}
* )
*/
protected $name;
I have to tell doctrine something like canBeNull=true
. Otherwhise I always get this error SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'name' cannot be null
But whats the code?
Define the attribute nullable in the COLUMN property with true.
Example: