Incorrect query build fix.

This commit is contained in:
Alexey Skobkin 2017-01-18 01:36:21 +03:00
parent 76b332155b
commit c83833c45d
2 changed files with 10 additions and 4 deletions

View file

@ -234,7 +234,13 @@ class UpdateSubscriptionsCommand extends ContainerAwareCommand
$usersForUpdate = $this->userRepo->findBy(['removed' => false]); $usersForUpdate = $this->userRepo->findBy(['removed' => false]);
} else { } else {
/** @var User $serviceUser */ /** @var User $serviceUser */
try {
$serviceUser = $this->userRepo->findActiveUserWithSubscribers($appUserId); $serviceUser = $this->userRepo->findActiveUserWithSubscribers($appUserId);
} catch (\Exception $e) {
$this->logger->error('Error while getting active user with subscribers', ['app_user_id' => $appUserId]);
throw $e;
}
if (!$serviceUser) { if (!$serviceUser) {
$this->logger->critical('Service user not found or marked as removed'); $this->logger->critical('Service user not found or marked as removed');

View file

@ -22,9 +22,9 @@ class UserRepository extends EntityRepository
->select(['u', 's', 'us']) ->select(['u', 's', 'us'])
->innerJoin('u.subscribers', 's') ->innerJoin('u.subscribers', 's')
->innerJoin('s.subscriber', 'us') ->innerJoin('s.subscriber', 'us')
->where('u.id = :id') ->where('u.id = :user_id')
->where('u.removed = FALSE') ->andWhere('u.removed = FALSE')
->setParameter('id', $id) ->setParameter('user_id', $id)
->getQuery()->getOneOrNullResult() ->getQuery()->getOneOrNullResult()
; ;
} }