Refactor
This commit is contained in:
parent
f08fb4cd67
commit
fc4121e776
1 changed files with 7 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue