2025-05-12 01:13:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Drupal\opd_daily_emails\Repository;
|
|
|
|
|
|
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
2025-05-12 08:05:20 +01:00
|
|
|
use Drupal\node\NodeInterface;
|
2025-05-12 01:13:25 +01:00
|
|
|
|
|
|
|
final class DailyEmailNodeRepository implements DailyEmailRepositoryInterface {
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
public readonly EntityTypeManagerInterface $entityTypeManager,
|
|
|
|
) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getAll(): array {
|
|
|
|
$query = $this->entityTypeManager
|
|
|
|
->getStorage('node')
|
|
|
|
->getQuery();
|
|
|
|
|
2025-05-12 08:05:20 +01:00
|
|
|
$query->condition('status', NodeInterface::PUBLISHED);
|
2025-05-12 01:13:25 +01:00
|
|
|
$query->condition('type', 'daily_email');
|
|
|
|
|
|
|
|
$query->accessCheck(TRUE);
|
|
|
|
|
|
|
|
$result = $query->execute();
|
|
|
|
|
|
|
|
// TODO: this returns a list of node IDs. Load and return the nodes.
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|