Add isNotParsed field on Entry entity

Fix #4350
This commit is contained in:
Nicolas Lœuillet
2023-07-28 14:58:43 +02:00
committed by Nicolas Lœuillet
parent 85065b509f
commit 20578f0b8e
16 changed files with 299 additions and 6 deletions

View File

@ -207,14 +207,15 @@ class EntryRepository extends ServiceEntityRepository
* @param string $order
* @param int $since
* @param string $tags
* @param string $detail 'metadata' or 'full'. Include content field if 'full'
* @param string $detail 'metadata' or 'full'. Include content field if 'full'
* @param string $domainName
* @param bool $isNotParsed
*
* @todo Breaking change: replace default detail=full by detail=metadata in a future version
*
* @return Pagerfanta
*/
public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '', $detail = 'full', $domainName = '')
public function findEntries($userId, $isArchived = null, $isStarred = null, $isPublic = null, $sort = 'created', $order = 'asc', $since = 0, $tags = '', $detail = 'full', $domainName = '', $isNotParsed = null)
{
if (!\in_array(strtolower($detail), ['full', 'metadata'], true)) {
throw new \Exception('Detail "' . $detail . '" parameter is wrong, allowed: full or metadata');
@ -244,6 +245,10 @@ class EntryRepository extends ServiceEntityRepository
$qb->andWhere('e.uid IS ' . (true === $isPublic ? 'NOT' : '') . ' NULL');
}
if (null !== $isNotParsed) {
$qb->andWhere('e.isNotParsed = :isNotParsed')->setParameter('isNotParsed', (bool) $isNotParsed);
}
if ($since > 0) {
$qb->andWhere('e.updatedAt > :since')->setParameter('since', new \DateTime(date('Y-m-d H:i:s', $since)));
}
@ -563,6 +568,24 @@ class EntryRepository extends ServiceEntityRepository
return $qb->getQuery()->getArrayResult();
}
/**
* @param int $userId
*
* @return array
*/
public function findAllEntriesIdByUserIdAndNotParsed($userId = null)
{
$qb = $this->createQueryBuilder('e')
->select('e.id')
->where('e.isNotParsed = true');
if (null !== $userId) {
$qb->where('e.user = :userid')->setParameter(':userid', $userId);
}
return $qb->getQuery()->getArrayResult();
}
/**
* Find all entries by url and owner.
*