I have two query builders defined.
First: Returns all accounts of an user.
Seconds: Returns all user transactions by account.
First:
public function getAccountsList($user)
{
return $this->getAccountRepository()
->createQueryBuilder('a')
->select('a')
->where('a.user = :user')
->setParameter('user', $user)
->getQuery()
->getResult();
}
Second:
public function getTransactionsList($user)
{
$accounts = $this->getAccountsList($user);
$query = $this->getTransactionRepository()
->createQueryBuilder('t')
->select('t')
->where('t.account IN (:accounts)')
->setParameter('account', $accounts)
->getQuery()
->getResult();
return $query;
}
First works perfect but second throws an error:
Invalid parameter: token account is not defined in the query
How to fix it?