Doctrine 2.1 - datetime column default value

前端 未结 7 1253
小蘑菇
小蘑菇 2020-12-30 18:51

Could someone tell me how to add default value on datetime column? I can\'t do this like this:

protected $registration_date = date(\"Y-m-d H:i:s\", time());
         


        
7条回答
  •  [愿得一人]
    2020-12-30 19:08

    Work for me with MySql and Symfony 3.4.

    ...
    fields:
        start_date:
            type: date
            nullable: false
            options:
                default: '1910-01-01'
                comment: 'The default date is 1910-01-01'
    ...
    

提交回复
热议问题