0
I have the table A
with a relationship OneToMany
with the table B
.
The table A
is small, has 10 records.
The table B
has N records for each record in the table A
.
From X to X minutes a script is executed that exports the 50 new records from the table B
(for each record in the table A
) to a file txt
, for example: the table A
has 10 records, so the system looks in the table B
the 50 new records for each record in the table A
, then it will be 10x50, then it will be exported to the file txt
500 records.
For that I made a innerjoin
in the repository:
class AppsRepository extends EntityRepository
{
public function findNewClients()
{
$qb = $this->createQueryBuilder('a');
$qb
->innerJoin('AppBundle\Entity\Clients', 'b', 'WITH', 'b.appId = a.id')
->where('b.proccessed is null')
;
return $qb->getQuery()->getResult();
}
}
I need to limit the innerjoin
to return only 50 records for each record in the table A
as I explained above.