diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php index 35883d7..184c767 100644 --- a/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/core/lib/Drupal/Core/CoreServiceProvider.php @@ -28,6 +28,7 @@ use Drupal\Core\DependencyInjection\Compiler\RegisterTwigExtensionsPass; use Drupal\Core\Plugin\PluginManagerPass; use Drupal\Core\Theme\ThemeNegotiatorPass; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Scope; @@ -53,7 +54,6 @@ public function register(ContainerBuilder $container) { // object and get reconstructed when the request object changes (e.g., // during a subrequest). $container->addScope(new Scope('request')); - $this->registerTwig($container); $this->registerUuid($container); diff --git a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php index eaa6390..2ebd091 100644 --- a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php @@ -153,8 +153,6 @@ public function __construct(EntityTypeInterface $entity_type, Connection $databa } // Check if the entity type has a dedicated table for fields. - // @todo Replace this with a check for the 'language' entity key when - // https://drupal.org/node/2143729 has landed. if ($data_table = $this->entityType->getDataTable()) { $this->dataTable = $data_table; // Entity types having both revision and translation support should always @@ -753,10 +751,23 @@ protected function mapToStorageRecord(ContentEntityInterface $entity, $table_key } $value = isset($definitions[$name]) && isset($entity->$name->value) ? $entity->$name->value : NULL; - // Since this is not a multi-column field we can assume there is only one - // column. - $definition = $definitions[$name]; - $serialize = !empty($definition->getColumns()[$definition->getMainPropertyName()]['serialize']); + // We allow for storage controllers to have schema fields which are not + // entity fields, which can be useful for normalization purposes. The + // 'default_langcode' field, for example, is simply a denormalization of + // checking the language code in the data table against the language code + // in the base table and similarly the 'isDefaultRevision' field (which we + // add as a query expression in + // FieldableDatabaseStorageController::buildQuery()) is a denormalization + // of checking the revision ID in the revision table against the revision + // ID in the base table. + $serialize = FALSE; + if (isset($definitions[$name])) { + $definition = $definitions[$name]; + // Since this is not a multi-column field we can assume there is only one + // column. + $serialize = !empty($definition->getColumns()[$definition->getMainPropertyName()]['serialize']); + } + $values[$name] = $serialize ? serialize($value) : $value; } @@ -865,13 +876,6 @@ public function getQueryServiceName() { /** * {@inheritdoc} */ - public function getSchemaBuilderServiceName() { - return 'entity.schema_builder.default'; - } - - /** - * {@inheritdoc} - */ protected function doLoadFieldItems($entities, $age) { $load_current = $age == static::FIELD_LOAD_CURRENT; diff --git a/core/lib/Drupal/Core/Entity/SqlStorageControllerInterface.php b/core/lib/Drupal/Core/Entity/SqlStorageControllerInterface.php index ead7f91..671cd77 100644 --- a/core/lib/Drupal/Core/Entity/SqlStorageControllerInterface.php +++ b/core/lib/Drupal/Core/Entity/SqlStorageControllerInterface.php @@ -12,13 +12,4 @@ * A common interface for SQL-based storage controllers. */ interface SqlStorageControllerInterface extends EntityStorageControllerInterface, SchemaBuilderInterface { - - /** - * Gets the name of the schema builder service for this entity storage. - * - * @return string - * The name of the schema builder service for this entity storage. - */ - public function getSchemaBuilderServiceName(); - }