symfony2 doctrine allow null values?

后端 未结 2 604
一整个雨季
一整个雨季 2021-01-01 08:32

So, I\'m still REALLY new to symfony but i\'m learning quickly... I created an entity and a crud (i forget how I did it actually but it was via the command line)..

2条回答
  •  星月不相逢
    2021-01-01 09:28

    I've just been looking for the solution, and wasn't happy with the accepted solution. [Edit: though I now know it's because I was using annotation]. The way I've found that works for me is setting nullable:

    /**
     * @ORM\Column(type="varchar", nullable=true)
     */
    private $totaltime = null;
    

提交回复
热议问题