$values = []; foreach($recordsas$id => $record){ $values[$id] = []; // Skip the item delta and item value levels (if possible) but let the
// field assign the value as suiting. This avoids unnecessary array
// hierarchies and saves memory here.
foreach($field_namesas$field_name){ $field_columns = $this->tableMapping->getColumnNames($field_name); // Handle field types that store several properties.
if(count($field_columns) > 1){ $definition_columns = $this->fieldStorageDefinitions[$field_name]->getColumns(); foreach($field_columnsas$property_name => $column_name){ if(property_exists($record, $column_name)){ $values[$id][$field_name][LanguageInterface::LANGCODE_DEFAULT][$property_name] = !empty($definition_columns[$property_name]['serialize']) ? unserialize($record->{$column_name}) : $record->{$column_name}; unset($record->{$column_name}); } } } // Handle field types that store only one property.
// There is just one field for each dedicated storage table, thus
// $field_name can only refer to it.
if(isset($field_name) && $this->requiresDedicatedTableStorage($this->fieldStorageDefinitions[$field_name])){ // Unlike in shared storage tables, in dedicated ones field columns are
// positioned last.
$this->allColumns[$table_name] = array_merge($this->getExtraColumns($table_name), $this->allColumns[$table_name]); } else{ $this->allColumns[$table_name] = array_merge($this->allColumns[$table_name], $this->getExtraColumns($table_name)); }
$field_definition_type = $field_definition->getType(); // Add all properties to views table data. We need an entry for each
// column of each field, with the first one given special treatment.
// @todo Introduce concept of the "main" column for a field, rather than
// assuming the first one is the main column. See also what the
// mapSingleFieldViewsData() method does with $first.
$first = TRUE; foreach($field_column_mappingas$field_column_name => $schema_field_name){ // The fields might be defined before the actual table.
// If the entity type is not using core's default entity storage, we can't
// assume the table mapping layout so we have to return only the latest
// tracked revisions.
if(!$storage instanceof SqlContentEntityStorage){ return$this->getTrackedEntities($workspace_id, $entity_type_id, $entity_ids)[$entity_type_id]; }