refactor: add an import for NodeInterface
This commit is contained in:
parent
170efaac78
commit
2bcd49e2db
|
@ -44,15 +44,17 @@ Loading entities by properties
|
||||||
|
|
||||||
.. code:: php
|
.. code:: php
|
||||||
|
|
||||||
|
use Drupal\node\NodeInterface;
|
||||||
|
|
||||||
// Load all published `event` nodes.
|
// Load all published `event` nodes.
|
||||||
\Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
|
\Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
|
||||||
'status' => \Drupal\node\NodeInterface::PUBLISHED,
|
'status' => NodeInterface::PUBLISHED,
|
||||||
'type' => 'event',
|
'type' => 'event',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Load all published `talk` nodes.
|
// Load all published `talk` nodes.
|
||||||
\Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
|
\Drupal::entityTypeManager()->getStorage('node')->loadByProperties([
|
||||||
'status' => \Drupal\node\NodeInterface::PUBLISHED,
|
'status' => NodeInterface::PUBLISHED,
|
||||||
'type' => 'talk',
|
'type' => 'talk',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue