Inject the TalkRepository into TalkCounter
This commit is contained in:
parent
29d88893fa
commit
afc0a0e448
3 changed files with 20 additions and 18 deletions
|
@ -6,6 +6,7 @@ namespace Drupal\opdavies_talks\Repository;
|
|||
|
||||
use Drupal\Core\Entity\EntityStorageInterface;
|
||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||
use Drupal\node\NodeInterface;
|
||||
use Drupal\opdavies_talks\Entity\Node\Talk;
|
||||
use Tightenco\Collect\Support\Collection;
|
||||
|
||||
|
@ -32,4 +33,16 @@ final class TalkRepository {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection|Talk[]
|
||||
*/
|
||||
public function findAllPublished(): Collection {
|
||||
$talks = $this->nodeStorage->loadByProperties([
|
||||
'status' => NodeInterface::PUBLISHED,
|
||||
'type' => 'talk',
|
||||
]);
|
||||
|
||||
return new Collection($talks);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue