4j: Add status condition to getAll()
This commit is contained in:
parent
a540f4ad32
commit
e925409f5f
|
@ -3,6 +3,7 @@
|
||||||
namespace Drupal\my_module\Repository;
|
namespace Drupal\my_module\Repository;
|
||||||
|
|
||||||
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||||
|
use Drupal\node\NodeInterface;
|
||||||
|
|
||||||
class ArticleRepository {
|
class ArticleRepository {
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ class ArticleRepository {
|
||||||
|
|
||||||
public function getAll(): array {
|
public function getAll(): array {
|
||||||
return $this->nodeStorage->loadByProperties([
|
return $this->nodeStorage->loadByProperties([
|
||||||
|
'status' => NodeInterface::PUBLISHED,
|
||||||
'type' => 'article',
|
'type' => 'article',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue