Doctrine2 findBy relationship object triggers string conversion error

后端 未结 3 943
遥遥无期
遥遥无期 2020-12-05 18:49

Say I have two entities in Doctrine2 that are related to each other, Models\\User and Models\\Comment. If I do this in Doctrine 2.0.0...



        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 19:04

    Query by relationship is allowed, but you have to pass the Identifier in there. Query by object is not yet supported and will only make it into 2.1.

    getRepository('Models\Comment')
    ->findBy(array('user' => $user->getId(), 'public' => true));
    

提交回复
热议问题