30 lines
765 B
PHP
30 lines
765 B
PHP
|
<?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);
|
||
|
}
|
||
|
|
||
|
}
|