function EntityStorageBase::getEntitiesByClass
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::getEntitiesByClass()
- 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::getEntitiesByClass()
Indexes the given array of entities by their class name and ID.
Parameters
\Drupal\Core\Entity\EntityInterface[] $entities: The array of entities to index.
Return value
\Drupal\Core\Entity\EntityInterface[][] An array of the passed-in entities, indexed by their class name and ID.
2 calls to EntityStorageBase::getEntitiesByClass()
- EntityStorageBase::delete in core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php - Deletes permanently saved entities.
- EntityStorageBase::postLoad in core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php - Attaches data to entities upon loading.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityStorageBase.php, line 652
Class
- EntityStorageBase
- A base entity storage class.
Namespace
Drupal\Core\EntityCode
protected function getEntitiesByClass(array $entities) : array {
$entity_classes = [];
foreach ($entities as $entity) {
$entity_classes[get_class($entity)][$entity->id()] = $entity;
}
return $entity_classes;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.