From e925409f5fa6007f3a247076c8ef49afb78a5614 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 14 Nov 2020 09:39:51 +0000 Subject: [PATCH] 4j: Add status condition to getAll() --- .../custom/my_module/src/Repository/ArticleRepository.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/modules/custom/my_module/src/Repository/ArticleRepository.php b/web/modules/custom/my_module/src/Repository/ArticleRepository.php index 83c7688..30bec82 100644 --- a/web/modules/custom/my_module/src/Repository/ArticleRepository.php +++ b/web/modules/custom/my_module/src/Repository/ArticleRepository.php @@ -3,6 +3,7 @@ namespace Drupal\my_module\Repository; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\node\NodeInterface; class ArticleRepository { @@ -14,6 +15,7 @@ class ArticleRepository { public function getAll(): array { return $this->nodeStorage->loadByProperties([ + 'status' => NodeInterface::PUBLISHED, 'type' => 'article', ]); }