4j: Add status condition to getAll()

This commit is contained in:
Oliver Davies 2020-11-14 09:39:51 +00:00
parent a540f4ad32
commit e925409f5f

View file

@ -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',
]);
}