nodeStorage = $entityTypeManager->getStorage('node'); } /** * @return Collection|Talk[] */ public function findAll(): Collection { $talks = $this->nodeStorage->loadByProperties($this->defaultProperties()); return new Collection($talks); } /** * @return Collection|Talk[] */ public function findAllPublished(): Collection { $talks = $this->nodeStorage->loadByProperties(array_merge( $this->defaultProperties(), [ 'status' => NodeInterface::PUBLISHED, ], )); return new Collection($talks); } private function defaultProperties(): array { return [ 'type' => 'talk', ]; } }