Answer the question
In order to leave comments, you need to log in
How to correctly set the column default value?
@ORM\Column(name="price", type="decimal", precision=7, scale=2, options={"default" : 0})
// или
/**
* @var int
*
* @Column(name="price", type="decimal", precision=7, scale=2)
*/
private $price= 0;
Answer the question
In order to leave comments, you need to log in
The second option (or even better is to set the value in the constructor).
The fact is that not all database vendors support the DEFAULT integrity constraint, so such options are placed in the options attribute .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question