protected function EntityStorageBase::getEntitiesByClass in Drupal 10
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 651
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;
}