Is there a way to query if array field contains a certain value in Doctrine2?

后端 未结 1 803
广开言路
广开言路 2021-01-01 15:49

Starting out with Symfony2 + Doctrine.

I have a table with User objects (fos_user), for which my schema contains a roles column of an \'array\' typ

1条回答
  •  我在风中等你
    2021-01-01 16:22

    You can simply use LIKE statement described in this manual (yes, even on serialized objects).

    I'd suggest you to create an entity class for roles and join it with the user entity by ManyToMany association.

    0 讨论(0)
提交回复
热议问题