20

When using the following only the last where is added to my query;

$qb = $this->getEntityManager()->createQueryBuilder();

$qb->select(array('qi'))
    ->from('Table:Qi', 'qi')
    ->where("qi.content = " . $content->getId())
    ->where("qi.queue = " . $child->getQueue()->getId());

I had to do this to make it take notice of both

$qb->select(array('qi'))
    ->from('Table:Qi', 'qi')
    ->where("qi.content = " . $content->getId() . 
                 " AND qi.queue = " . $child->getQueue()->getId());

This does not seem right? How can I use the first approach with multiple where calls?

1 Answer 1

31

You can use ->andWhere like this:

->where("qi.content = " . $content->getId())
->andWhere("qi.queue = " . $child->getQueue()->getId());
Sign up to request clarification or add additional context in comments.

1 Comment

you actually dont need to use ->where before andWhere. You can alway use ->andWhere();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.