/**
* Set the QueryBuilder where parameters.
*
* @param ContentRepository $contentRepo
* @param string $type
*
* @throws \Exception
*
* @return Content[]|false
*/
private function getTimedRecords(ContentRepository $contentRepo, $type)
{
/** @var QueryBuilder $query */
$query = $contentRepo->createQueryBuilder('t')->select('t.id')->andWhere('t.status = :status')->setParameter('currenttime', Carbon::now(), Type::DATETIME);
if ($type === 'publish') {
$this->getTimedQuery($query);
} elseif ($type === 'hold') {
$this->getPublishedQuery($query);
} else {
throw new StorageException(sprintf('Invalid type "%s" for timed record processing.', $type));
}
return $contentRepo->findWith($query) ?: [];
}