protected SqlContentEntityStorage::getFromStorage(array $ids = NULL)
Gets entities from the storage.
Parameters
array|null $ids: If not empty, return entities that match these IDs. Return all entities when NULL.
Return value
\Drupal\Core\Entity\ContentEntityInterface[] Array of entities from the storage.
File
- core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 417
Class
- SqlContentEntityStorage
- A content entity database storage implementation.
Namespace
Drupal\Core\Entity\Sql
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | protected function getFromStorage( array $ids = NULL) { $entities = array (); if (! empty ( $ids )) { // Sanitize IDs. Before feeding ID array into buildQuery, check whether // it is empty as this would load all entities. $ids = $this ->cleanIds( $ids ); } if ( $ids === NULL || $ids ) { // Build and execute the query. $query_result = $this ->buildQuery( $ids )->execute(); $records = $query_result ->fetchAllAssoc( $this ->idKey); // Map the loaded records into entity objects and according fields. if ( $records ) { $entities = $this ->mapFromStorageRecords( $records ); } } return $entities ; } |
Please login to continue.