- Rename `opdavies_blog` to `blog`. - Rename `opdavies_blog_test` to `blog_test`. - Rename `opdavies_talks` to `talks`. - Rename `opdavies_talks_test` to `talks_test`. The files within the directories haven't changed, so there is no breaking change caused by renaming the directories. Please enter the commit message for your changes. Lines starting
35 lines
798 B
PHP
35 lines
798 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Drupal\opdavies_talks\Repository;
|
|
|
|
use Drupal\Core\Entity\EntityStorageInterface;
|
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
|
use Drupal\opdavies_blog\Entity\Node\Talk;
|
|
use Illuminate\Support\Collection;
|
|
|
|
final class TalkRepository {
|
|
|
|
private EntityStorageInterface $nodeStorage;
|
|
|
|
public function __construct(EntityTypeManagerInterface $entityTypeManager) {
|
|
$this->nodeStorage = $entityTypeManager->getStorage('node');
|
|
}
|
|
|
|
/**
|
|
* @return Collection|Talk[]
|
|
*/
|
|
public function getAll(bool $publishedOnly = FALSE): Collection {
|
|
$properties = ['type' => 'talk'];
|
|
|
|
if ($publishedOnly) {
|
|
$properties['status'] = TRUE;
|
|
}
|
|
|
|
return new Collection(
|
|
$this->nodeStorage->loadByProperties($properties)
|
|
);
|
|
}
|
|
|
|
}
|