Added button to show entries with the same domain

This commit is contained in:
Nicolas Lœuillet
2021-01-04 09:28:56 +01:00
committed by Jeremy Benoist
parent 84dcaaaea9
commit 890c7d0bfa
11 changed files with 64 additions and 5 deletions

View File

@ -39,7 +39,34 @@ class EntryRepository extends EntityRepository
return $this
->getSortedQueryBuilderByUser($userId)
->andWhere('e.isArchived = false')
;
;
}
/**
* Retrieves entries with the same domain.
*
* @param int $userId
* @param int $entryId
*
* @return QueryBuilder
*/
public function getBuilderForSameDomainByUser($userId, $entryId)
{
$queryBuilder = $this->createQueryBuilder('e');
return $this
->getSortedQueryBuilderByUser($userId)
->andWhere('e.id <> :entryId')->setParameter('entryId', $entryId)
->andWhere(
$queryBuilder->expr()->in(
'e.domainName',
$this
->createQueryBuilder('e2')
->select('e2.domainName')
->where('e2.id = :entryId')->setParameter('entryId', $entryId)
->getDQL()
)
);
}
/**