1
내가 쿼리에서 필드 이름에 변수를 배치하려고, 그래서 스키마가 :Doctrine2 QueryBuilder - 필드 이름에 변수
id amazon - tesco - asda - happyshopper -
1 £5 - NULL - NULL - £4.99
2 NULL - £2.99 - NULL - NULL
다음
$store = 'amazon';
$qb = $em->createQueryBuilder();
$products = $qb->select('p')->from('MyBundle:Product', 'p')
->where('p.:store IS NOT NULL')
->setParameter('store', $store)
->add('orderBy', 'p.onSale DESC')
->setMaxResults(40)
->getQuery()
->getResult();
에서 반환 할 행을 1.
내가 무슨 짓을했는지 :
->where('p.:store IS NOT NULL')
->setParameter('store', $store)
올바르지 않으므로 오류가 발생합니다.
->where(':store IS NOT NULL')
->setParameter('store', $store)
오류는 아니지만 저장소 필터는 적용되지 않습니다.
내 다음 작업 그게 전부, 구조를 정렬! 감사. – BobFlemming