4i: Update getAll() method

Ensure that only published articles are returned from the `getAll()`
method on the article repository.
This commit is contained in:
Oliver Davies 2020-03-19 21:35:26 +00:00
parent 02c732b60b
commit 92ca064737

View file

@ -3,6 +3,7 @@
namespace Drupal\my_module\Repository;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\node\NodeInterface;
class ArticleRepository {
@ -17,6 +18,7 @@ class ArticleRepository {
public function getAll(): array {
return $this->nodeStorage->loadByProperties([
'status' => NodeInterface::PUBLISHED,
'type' => 'article',
]);
}