This commit is contained in:
Oliver Davies 2025-06-16 22:17:33 +01:00
parent cddb3af518
commit f08fb4cd67
5 changed files with 50 additions and 14 deletions

View file

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace Drupal\opd_presentations\Repository;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\node\NodeInterface;
use Drupal\opd_presentations\Presentation;
final class PresentationNodeRepository implements PresentationRepositoryInterface {
public function __construct(private EntityTypeManagerInterface $entityTypeManager) {
}
public function getPublished(): array {
$nodeStorage = $this->entityTypeManager->getStorage('node');
$query = $nodeStorage->getQuery();
$query->accessCheck();
$query->condition('status', NodeInterface::PUBLISHED);
$query->condition('type', Presentation::NODE_TYPE);
$nodeIds = $query->execute();
return $nodeStorage->loadMultiple($nodeIds);
}
}