I have an entity with property:
/**
* @var string The title attr
*
* @ORM\Column(type="string", length=255)
*/
protected $title = '';
And form type is:
$builder
->add('title', 'text', array(
'required' => false,
))
But when I get this empty value from form and try to save this entity to the DB I get the following error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null
Why is it null? I set this property to the empty string '', and not null.
How can I store this entity in the DB with empty string '' (and without @ORM\Column(type="string", length=255, nullable=true))?