+6 votes

The default value of a column is not used when exporting to Doctrine annotations.
According to the documentation, there is no specific annotation for it, but it's possible to define it directly in the class :

   * @ORM\Column(type="string", nullable=false)
  private $name = "Default name";


in Feature Request by (480 points)
recategorized by

Thanks for info. We will add this feature in one of future release.

+1 for default values being translated from ORMD to Doctrine2 PHP annotations. Well, not annotations exactly because as Ludek says above they aren't supported but they can be achieved via property setting.


When this feature will be implemented? We are evaluating the software and it would be very important to us.

1 Answer

0 votes

We have discussed this feature again and evaluated possible ways how to implement it. To achieve this functionality would mean that ORM Designer would have to modify the PHP code (not only the @ORM annotations as is the current state).

ORM Designer does not allow for this due to security reasons. And because this change would mean huge changes in the architecture of ORM Designer, we have to abandon this feature for now. Unfortunately we do not plan to implement it in the near future.

by Skipper developer (74.8k points)


It seems there is an option called default - you could support this its working, but skipper of course overwrites my changes.



 * @ORM\Column(type="boolean", nullable=false, options={"default":0})
private $public;

Thanks for posting this. We have a plans to add it to next release.

Waiting for that, the trick is to add an default option in Doctrine2.skipper.cfg.xml

like this :

<struct name="options" help-text= "" help-url="">
      <attribute name="version" type="string" help-text= "" help-url=""/>
      <attribute name="comment" type="string" help-text= "" help-url=""/>
      <attribute name="unsigned" type="bool" help-text= "" help-url=""/>
      <attribute name="default" type="string" help-text= "" help-url=""/>

Yes, you can use it also by this way, but in this case you need to enter default value via property-editor and not via "default" column in table editor. We want to implement the second way.