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) ); } }