Doctrine does not support default values for table columns. I think I
read somewhere that the reason behind this, is that not all databases
support the notion of default values. The closest you can get, is
assigning default values to the properties, or in the constructor,
like you have done.
Although, Doctrine is pretty flexible, there may already be a MySQL
specific vendor extension, that let's you set up default values from
the mappings, maybe someone will chime in on this.
On Apr 26, 1:33 pm, Chris Breen <kurl.co...@gmail.com> wrote:
> Dearest Doctrine helpers,
> I've been tearing my hair out for I'd say at least 3 days trying to
> generate a clean update script from the schema tool.
> After fixing all the foreign keys and enums (Sorry, yes, I'm using mysql).
> The only differences I am left with are the default values.
> I have added the columnDefinition values in a variety of different orders.
> I somehow thought that the diff may have been done twice, check values then
> check the generated SQL against the current SQL. This did not help.
> I've also tried setting the value in the entities ala private $columnName =
> value; and also in the constructor. I only tried these as this is all I
> have found searching to try.
> I've debugged this until I am blue in the face and I cannot figure out how
> to set a default value from the entity metadata to provide the correct diff
> so I do not get any changes when I run the schema tool.
> I'm using Doctrine 2.2.1 with mysql.
> I can provide code fragments, examples, anything. Please help :(
> Thanks
> Chris