Optimize memory usage for batch processing of template images

NewsletterTemplateEntity carries base64 data of image. This commit changes how we load templates entities when we process thumbnail images so that there is only one template in memory.
[MAILPOET-2686]
This commit is contained in:
Rostislav Wolny
2021-10-20 12:24:56 +02:00
committed by Veljko V
parent ab23b06ff8
commit 5134713c2d
3 changed files with 24 additions and 2 deletions

View File

@@ -98,4 +98,14 @@ class NewsletterTemplatesRepository extends Repository {
->getQuery()
->getSingleScalarResult();
}
public function getIdsOfEditableTemplates(): array {
$result = $this->doctrineRepository->createQueryBuilder('nt')
->select('nt.id')
->where('nt.readonly = :readonly')
->setParameter('readonly', false)
->getQuery()
->getArrayResult();
return array_column($result, 'id');
}
}