diff --git a/modules/opd_presentations/src/Repository/PresentationNodeRepository.php b/modules/opd_presentations/src/Repository/PresentationNodeRepository.php index 8cf4ef3bd..b61dc811f 100644 --- a/modules/opd_presentations/src/Repository/PresentationNodeRepository.php +++ b/modules/opd_presentations/src/Repository/PresentationNodeRepository.php @@ -6,24 +6,26 @@ namespace Drupal\opd_presentations\Repository; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\node\NodeInterface; +use Drupal\node\NodeStorageInterface; use Drupal\opd_presentations\Presentation; final class PresentationNodeRepository implements PresentationRepositoryInterface { - public function __construct(private EntityTypeManagerInterface $entityTypeManager) { + private NodeStorageInterface $nodeStorage; + + public function __construct(EntityTypeManagerInterface $entityTypeManager) { + $this->nodeStorage = $entityTypeManager->getStorage('node'); } public function getPublished(): array { - $nodeStorage = $this->entityTypeManager->getStorage('node'); - - $query = $nodeStorage->getQuery(); + $query = $this->nodeStorage->getQuery(); $query->accessCheck(); $query->condition('status', NodeInterface::PUBLISHED); $query->condition('type', Presentation::NODE_TYPE); $nodeIds = $query->execute(); - return $nodeStorage->loadMultiple($nodeIds); + return $this->nodeStorage->loadMultiple($nodeIds); } }