How do I set a default value in Doctrine 2?
<?php
/**
* @Entity
*/
class myEntity {
/**
* @var string
*
* @ORM\Column(name="myColumn", type="integer", options={"default" : 0})
*/
private $myColumn;
...
}
Note that this uses SQL DEFAULT
, which is not supported for some fields like BLOB
and TEXT
.