Doctrine and LIKE query

后端 未结 5 1815
滥情空心
滥情空心 2021-02-06 20:44

I have entity for Doctrine:



        
5条回答
  •  花落未央
    2021-02-06 21:00

    This is not possible with the magic find methods. Try using the query builder:

    $result = $em->getRepository("Orders")->createQueryBuilder('o')
       ->where('o.OrderEmail = :email')
       ->andWhere('o.Product LIKE :product')
       ->setParameter('email', 'some@mail.com')
       ->setParameter('product', 'My Products%')
       ->getQuery()
       ->getResult();
    

提交回复
热议问题