Doctrine 2 association without foreign key constraints

后端 未结 6 1598
醉酒成梦
醉酒成梦 2020-12-16 03:40

I\'m in the process of converting a legacy PHP application to Symfony 2. The application data is not very consistent at the moment, so I would like to avoid creating foreign

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-16 04:40

    I had to go through the same process recently and fortunately there is an easy solution, just add nullable=true to the column's annotation.

    This will work as long as the existing data is valid, in my case I had to change 0's to NULL's and change keys that didn't exist anymore to NULL.

提交回复
热议问题