mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-713: Adding handling of 'default' setting to YamlDriver - with patch #879
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jul 22, 2010).
Jira issue originally created by user theduke:
In the current trunk the YamlDriver lacks support for setting the default.
Probably just a lazy oversight, simple fix....
Patch is included.
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by romanb:
It is not intended that there is a "default" option. Use either plain php default values or columnDefinition for database default values. The former is strongly preferred as Doctrine will not go to the database to read any db-generated default values after insertion.
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by theduke:
Hi Roman.
What you are describing, setting a default for the database backend, is exactly what I wanted to achieve.
The current YamlDriver implementation does not allow this though!
My patch is actually working, and allows you to set a default value for the schema tool to create the database with.
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by romanb:
It does allow it, through the columnDefinition attribute. Your patch works because "default" is still supported by the DBAL but this is more of a legacy.
The ORM has no "default" attribute, it was removed earlier. The logic is that default values specified this way are not portable anyway so you can just as well use the columnDefinition property.
Example with annotations:
@doctrinebot commented on GitHub (Jul 22, 2010):
Issue was closed with resolution "Won't Fix"
@doctrinebot commented on GitHub (Jul 22, 2010):
Comment created by romanb:
Let me add again that php-level default values are absolutely preferrable in most cases as the default value is usually a part of the domain model and will otherwise not be available on newly inserted objects. Doctrine will not go back to the database after insertion to read the database-generated default value.
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/d22e65631fd2d7b9c2a9