This commit is contained in:
Oliver Davies 2025-06-17 23:31:49 +01:00
parent fc4121e776
commit 8a480121d2

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Drupal\opd_presentations\Repository;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\Query\QueryInterface;
use Drupal\node\NodeInterface;
use Drupal\node\NodeStorageInterface;
use Drupal\opd_presentations\Presentation;
@ -18,14 +19,19 @@ final class PresentationNodeRepository implements PresentationRepositoryInterfac
}
public function getPublished(): array {
$query = $this->nodeStorage->getQuery();
$query->accessCheck();
$query = $this->query();
$query->condition('status', NodeInterface::PUBLISHED);
$query->condition('type', Presentation::NODE_TYPE);
$nodeIds = $query->execute();
return $this->nodeStorage->loadMultiple($nodeIds);
}
private function query(): QueryInterface {
$query = $this->nodeStorage->getQuery();
$query->accessCheck();
$query->condition('type', Presentation::NODE_TYPE);
return $query;
}
}