DDC-1733: [GH-311] Proposal: Support for default attribute in yaml mappings. #2177

Closed
opened 2026-01-22 13:43:24 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 28, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

This issue is created automatically through a Github pull request on behalf of benlumley:

Url: https://github.com/doctrine/doctrine2/pull/311

Message:

There's probably a very good reason you don't already do this... please let me know if there is!

The EntityGenerator supports writing a default value for a property/column when generating a class, but the yaml driver doesn't pick this up. This tiny change makes it work - you can do something like:

Acme\MyBundle\Entity\MyObject:
  type: entity
  table: my_object
  fields:
    active:
      type: boolean
      default: true

and you end up with..

/****
 * @var boolean $active
 */
private $active = true;

Similar change would also work for the other drivers I guess.

Originally created by @doctrinebot on GitHub (Mar 28, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: This issue is created automatically through a Github pull request on behalf of benlumley: Url: https://github.com/doctrine/doctrine2/pull/311 Message: There's probably a very good reason you don't already do this... please let me know if there is! The EntityGenerator supports writing a default value for a property/column when generating a class, but the yaml driver doesn't pick this up. This tiny change makes it work - you can do something like: ``` Acme\MyBundle\Entity\MyObject: type: entity table: my_object fields: active: type: boolean default: true ``` and you end up with.. ``` /**** * @var boolean $active */ private $active = true; ``` Similar change would also work for the other drivers I guess.
admin added the Bug label 2026-01-22 13:43:24 +01:00
admin closed this issue 2026-01-22 13:43:24 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 29, 2012):

Comment created by @beberlei:

A related Github Pull-Request [GH-311] was closed
https://github.com/doctrine/doctrine2/pull/311

@doctrinebot commented on GitHub (Mar 29, 2012): Comment created by @beberlei: A related Github Pull-Request [GH-311] was closed https://github.com/doctrine/doctrine2/pull/311
Author
Owner

@doctrinebot commented on GitHub (Mar 30, 2012):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Mar 30, 2012): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Dec 19, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-311] was closed:
https://github.com/doctrine/common/pull/311

@doctrinebot commented on GitHub (Dec 19, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-311] was closed: https://github.com/doctrine/common/pull/311
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2177