Why can't the value be null? If empty string == null and that's a desired 
acceptable input is there a reason the field can't be null?

-Alex
-----Original Message-----
From: Dennis Jacobfeuerborn <djacobfeuerb...@gmail.com>
Sender: symfony-users@googlegroups.com
Date: Sun, 27 Mar 2011 14:48:34 
To: <symfony-users@googlegroups.com>
Reply-To: symfony-users@googlegroups.com
Subject: [symfony-users] [Symfony2] Forms/Doctrine empty string vs. NULL

Hi,
I'm trying to create a form for an entity with a field that is defined as 
"NOT NULL" in the schema but with the field allowing to contain an empty 
string.
The problem is that when I set required to false on the field and submit the 
form with not putting anything in it I get an exception that the column is 
not allowed to be NULL.
When I set required to true then the form forces me to enter something into 
the field.
In the constructor of the entity I explicitly initialize the property to "".

What is the proper way to tell the form/doctrine to store the empty field as 
an empty string and not as NULL?

Regards,
   Dennis

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to