mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Moved visits iteration logic from command to service to allow lazy loading of entries in resultset
This commit is contained in:
@@ -10,15 +10,12 @@ use Shlinkio\Shlink\Core\Entity\Visit;
|
||||
|
||||
class VisitRepository extends EntityRepository implements VisitRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @return Visit[]
|
||||
*/
|
||||
public function findUnlocatedVisits(): array
|
||||
public function findUnlocatedVisits(): iterable
|
||||
{
|
||||
$qb = $this->createQueryBuilder('v');
|
||||
$qb->where($qb->expr()->isNull('v.visitLocation'));
|
||||
|
||||
return $qb->getQuery()->getResult();
|
||||
return $qb->getQuery()->iterate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,10 +10,7 @@ use Shlinkio\Shlink\Core\Entity\Visit;
|
||||
|
||||
interface VisitRepositoryInterface extends ObjectRepository
|
||||
{
|
||||
/**
|
||||
* @return Visit[]
|
||||
*/
|
||||
public function findUnlocatedVisits(): array;
|
||||
public function findUnlocatedVisits(): iterable;
|
||||
|
||||
/**
|
||||
* @param ShortUrl|int $shortUrl
|
||||
|
||||
Reference in New Issue
Block a user