How to define column default value?

@ORM\Column(name="price" type="decimal", precision=7, scale=2, options={"default" : 0})
// or
/**
 * @var int
*
 * @Column(name="price" type="decimal", precision=7, scale=2)
*/
 private $price= 0;


The same thing in relation to nullable datetime, text, string values.
June 10th 19 at 16:22
1 answer
June 10th 19 at 16:24
Solution
The second option (or even better - set the value in the constructor).

The fact is that not all database vendors support integrity constraints DEFAULT, so this option is passed to the attribute options.

Find more questions by tags Doctrine ORM