Answer the question
In order to leave comments, you need to log in
How to do an UPDATE JOIN query in Doctrine?
There is a code:
$em = $this->getServiceLocator()->get(EntityManager::class);
$qb = $em->createQueryBuilder();
$qb->update(ReCall::class, 'rc')
->innerJoin(CallChannel::class, 'ch', Join::WITH, 'rc.call = ch.call')
->set('rc.reached', '1')
->where('rc.reached = 0 AND ch.shoulder = \'A\' AND ch.callerPhone = :phone')
->setParameter('phone', $channel->getCallerPhone());
$qb->getQuery()->getResult();
[Semantical Error] line 0, col 79 near 'ch.shoulder =': Error: 'ch' is not defined.Call not found
$em = $this->getServiceLocator()->get(EntityManager::class);
$qb = $em->createQueryBuilder();
$qb->select('rc')
->from(ReCall::class, 'rc')
->where('rc.reached = 0 AND ch.shoulder = \'A\' AND ch.callerPhone = :phone')
->setParameter('phone', $callerPhone)
->innerJoin(CallChannel::class, 'ch', Join::WITH, 'rc.call = ch.call')
->orderBy('rc.createdDatetime');
$data = $qb->getQuery()->getResult();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question