diff --git a/web/modules/custom/talks/src/Repository/TalkRepository.php b/web/modules/custom/talks/src/Repository/TalkRepository.php index b1fdcf8..b8da892 100644 --- a/web/modules/custom/talks/src/Repository/TalkRepository.php +++ b/web/modules/custom/talks/src/Repository/TalkRepository.php @@ -21,16 +21,12 @@ final class TalkRepository { /** * @return Collection|Talk[] */ - public function getAll(bool $publishedOnly = FALSE): Collection { - $properties = ['type' => 'talk']; + public function findAll(): Collection { + $talks = $this->nodeStorage->loadByProperties([ + 'type' => 'talk', + ]); - if ($publishedOnly) { - $properties['status'] = TRUE; - } - - return new Collection( - $this->nodeStorage->loadByProperties($properties) - ); + return new Collection($talks); } /** diff --git a/web/modules/custom/talks/src/Service/TalkDateUpdater.php b/web/modules/custom/talks/src/Service/TalkDateUpdater.php index 60e3797..14353ad 100644 --- a/web/modules/custom/talks/src/Service/TalkDateUpdater.php +++ b/web/modules/custom/talks/src/Service/TalkDateUpdater.php @@ -25,7 +25,7 @@ final class TalkDateUpdater { } public function __invoke(): void { - foreach ($this->talkRepository->getAll() as $talk) { + foreach ($this->talkRepository->findAll() as $talk) { $this->updateNextEventDate($talk); } } diff --git a/web/modules/custom/talks/tests/src/Kernel/Repository/TalkRepositoryTest.php b/web/modules/custom/talks/tests/src/Kernel/Repository/TalkRepositoryTest.php index ed78a7c..f463eb9 100644 --- a/web/modules/custom/talks/tests/src/Kernel/Repository/TalkRepositoryTest.php +++ b/web/modules/custom/talks/tests/src/Kernel/Repository/TalkRepositoryTest.php @@ -22,7 +22,7 @@ final class TalkRepositoryTest extends TalksTestBase { $this->createTalk(['title' => 'Taking Flight with Tailwind CSS']); $this->createTalk(['title' => 'Upgrading to Drupal 9']); - $talks = $this->talkRepository->getAll(); + $talks = $this->talkRepository->findAll(); $this->assertCount(3, $talks); $this->assertSame( @@ -57,7 +57,7 @@ final class TalkRepositoryTest extends TalksTestBase { public function it_only_returns_talk_nodes(): void { $this->createNode(['type' => 'page']); - $talks = $this->talkRepository->getAll(); + $talks = $this->talkRepository->findAll(); $this->assertEmpty($talks); }