diff --git a/core/includes/entity.inc b/core/includes/entity.inc index bfefff5..50c7f59 100644 --- a/core/includes/entity.inc +++ b/core/includes/entity.inc @@ -96,7 +96,7 @@ function entity_invoke_bundle_hook($hook, $entity_type, $bundle, $bundle_new = N * * @see \Drupal\Core\Entity\EntityManagerInterface * @see \Drupal\Core\Entity\EntityStorageInterface - * @see \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @see \Drupal\Core\Entity\Query\QueryInterface */ function entity_load($entity_type, $id, $reset = FALSE) { @@ -121,7 +121,7 @@ function entity_load($entity_type, $id, $reset = FALSE) { * * @see \Drupal\Core\Entity\EntityManagerInterface * @see \Drupal\Core\Entity\EntityStorageInterface - * @see \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ function entity_revision_load($entity_type, $revision_id) { return \Drupal::entityManager() @@ -176,13 +176,13 @@ function entity_load_by_uuid($entity_type_id, $uuid) { * * The actual loading is done through a class that has to implement the * Drupal\Core\Entity\EntityStorageInterface interface. By default, - * Drupal\Core\Entity\ContentEntityDatabaseStorage is used for content entities + * Drupal\Core\Entity\Sql\SqlContentEntityStorage is used for content entities * and Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Entity * types can specify that a different class should be used by setting the * "controllers['storage']" key in the entity plugin annotation. These classes * can either implement the Drupal\Core\Entity\EntityStorageInterface * interface, or, most commonly, extend the - * Drupal\Core\Entity\ContentEntityDatabaseStorage class. + * Drupal\Core\Entity\Sql\SqlContentEntityStorage class. * See Drupal\node\Entity\Node and Drupal\node\NodeStorage * for an example. * @@ -198,7 +198,7 @@ function entity_load_by_uuid($entity_type_id, $uuid) { * * @see \Drupal\Core\Entity\EntityManagerInterface * @see \Drupal\Core\Entity\EntityStorageInterface - * @see \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @see \Drupal\Core\Entity\Query\QueryInterface */ function entity_load_multiple($entity_type, array $ids = NULL, $reset = FALSE) { diff --git a/core/lib/Drupal/Core/Entity/ContentEntityType.php b/core/lib/Drupal/Core/Entity/ContentEntityType.php index d303de4..213c097 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityType.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityType.php @@ -18,7 +18,7 @@ class ContentEntityType extends EntityType implements ContentEntityTypeInterface public function __construct($definition) { parent::__construct($definition); $this->handlers += array( - 'storage' => 'Drupal\Core\Entity\ContentEntityDatabaseStorage', + 'storage' => 'Drupal\Core\Entity\Sql\SqlContentEntityStorage', ); } diff --git a/core/lib/Drupal/Core/Entity/EntityStorageInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageInterface.php index 32867f4..7a329cc 100644 --- a/core/lib/Drupal/Core/Entity/EntityStorageInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityStorageInterface.php @@ -11,7 +11,7 @@ * Defines the interface for entity storage classes. * * For common default implementations, see - * \Drupal\Core\Entity\ContentEntityDatabaseStorage for content entities and + * \Drupal\Core\Entity\Sql\SqlContentEntityStorage for content entities and * \Drupal\Core\Config\Entity\ConfigEntityStorage for config entities. Those * implementations are used by default when the @ContentEntityType or * @ConfigEntityType annotations are used. diff --git a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php index a1c1bc9..7e8662b 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeInterface.php @@ -535,7 +535,7 @@ public function getBundleLabel(); /** * Returns the name of the entity's base table. * - * @todo Used by ContentEntityDatabaseStorage only. + * @todo Used by SqlContentEntityStorage only. * * @return string|null * The name of the entity's base table, or NULL if none exists. @@ -572,7 +572,7 @@ public function getConfigPrefix(); /** * Returns the name of the entity's revision data table. * - * @todo Used by ContentEntityDatabaseStorage only. + * @todo Used by SqlContentEntityStorage only. * * @return string|null * The name of the entity type's revision data table, or NULL if none @@ -583,7 +583,7 @@ public function getRevisionDataTable(); /** * Returns the name of the entity's revision table. * - * @todo Used by ContentEntityDatabaseStorage only. + * @todo Used by SqlContentEntityStorage only. * * @return string|null * The name of the entity type's revision table, or NULL if none exists. @@ -593,7 +593,7 @@ public function getRevisionTable(); /** * Returns the name of the entity's data table. * - * @todo Used by ContentEntityDatabaseStorage only. + * @todo Used by SqlContentEntityStorage only. * * @return string|null * The name of the entity type's data table, or NULL if none exists. diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php similarity index 98% rename from core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php rename to core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index c9532f4..1814564 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -2,19 +2,24 @@ /** * @file - * Contains \Drupal\Core\Entity\ContentEntityDatabaseStorage. + * Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorage. */ -namespace Drupal\Core\Entity; +namespace Drupal\Core\Entity\Sql; use Drupal\Component\Utility\String; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Connection; use Drupal\Core\Database\Database; +use Drupal\Core\Entity\ContentEntityInterface; +use Drupal\Core\Entity\ContentEntityStorageBase; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\EntityStorageException; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\EntityTypeListenerInterface; use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; use Drupal\Core\Entity\Query\QueryInterface; -use Drupal\Core\Entity\Sql\DefaultTableMapping; -use Drupal\Core\Entity\Sql\SqlEntityStorageInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Language\LanguageInterface; @@ -26,15 +31,15 @@ * This class can be used as-is by most content entity types. Entity types * requiring special handling can extend the class. * - * The class uses \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema + * The class uses \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema * internally in order to automatically generate the database schema based on * the defined base fields. Entity types can override - * ContentEntityDatabaseStorage::getSchema() to customize the generated + * SqlContentEntityStorage::getSchema() to customize the generated * schema; e.g., to add additional indexes. * * @ingroup entity_api */ -class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, EntityTypeListenerInterface { +class SqlContentEntityStorage extends ContentEntityStorageBase implements SqlEntityStorageInterface, EntityTypeListenerInterface { /** * The mapping of field columns to SQL tables. @@ -139,7 +144,7 @@ public function getFieldStorageDefinitions() { } /** - * Constructs a ContentEntityDatabaseStorage object. + * Constructs a SqlContentEntityStorage object. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type definition. @@ -220,12 +225,12 @@ public function getRevisionDataTable() { /** * Gets the schema handler for this entity storage. * - * @return \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema + * @return \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema * The schema handler. */ protected function schemaHandler() { if (!isset($this->schemaHandler)) { - $schema_handler_class = $this->entityType->getHandlerClass('storage_schema') ?: 'Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema'; + $schema_handler_class = $this->entityType->getHandlerClass('storage_schema') ?: 'Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema'; $this->schemaHandler = new $schema_handler_class($this->entityManager, $this->entityType, $this, $this->database); } return $this->schemaHandler; @@ -1016,8 +1021,8 @@ protected function mapToStorageRecord(ContentEntityInterface $entity, $table_nam * @return bool * TRUE if the the column is serial, FALSE otherwise. * - * @see \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema::processBaseTable() - * @see \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema::processRevisionTable() + * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::processBaseTable() + * @see \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::processRevisionTable() */ protected function isColumnSerial($table_name, $schema_name) { $result = FALSE; diff --git a/core/lib/Drupal/Core/Entity/Schema/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php similarity index 98% rename from core/lib/Drupal/Core/Entity/Schema/SqlContentEntityStorageSchema.php rename to core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index 949792e..32c83c7 100644 --- a/core/lib/Drupal/Core/Entity/Schema/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -2,16 +2,16 @@ /** * @file - * Contains \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema. + * Contains \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema. */ -namespace Drupal\Core\Entity\Schema; +namespace Drupal\Core\Entity\Sql; use Drupal\Core\Database\Connection; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\Schema\EntitySchemaHandlerInterface; /** * Defines a schema handler that supports revisionable, translatable entities. @@ -35,7 +35,7 @@ class SqlContentEntityStorageSchema implements EntitySchemaHandlerInterface { /** * The storage object for the given entity type. * - * @var \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; @@ -60,12 +60,12 @@ class SqlContentEntityStorageSchema implements EntitySchemaHandlerInterface { * The entity manager. * @param \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type * The entity type. - * @param \Drupal\Core\Entity\ContentEntityDatabaseStorage $storage + * @param \Drupal\Core\Entity\Sql\SqlContentEntityStorage $storage * The storage of the entity type. This must be an SQL-based storage. * @param \Drupal\Core\Database\Connection $database * The database connection to be used. */ - public function __construct(EntityManagerInterface $entity_manager, ContentEntityTypeInterface $entity_type, ContentEntityDatabaseStorage $storage, Connection $database) { + public function __construct(EntityManagerInterface $entity_manager, ContentEntityTypeInterface $entity_type, SqlContentEntityStorage $storage, Connection $database) { $this->entityType = $entity_type; $this->fieldStorageDefinitions = $entity_manager->getFieldStorageDefinitions($entity_type->id()); $this->storage = $storage; diff --git a/core/modules/aggregator/src/FeedStorage.php b/core/modules/aggregator/src/FeedStorage.php index 10141fa..9017974 100644 --- a/core/modules/aggregator/src/FeedStorage.php +++ b/core/modules/aggregator/src/FeedStorage.php @@ -7,15 +7,15 @@ namespace Drupal\aggregator; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * Controller class for aggregator's feeds. * - * This extends the Drupal\Core\Entity\ContentEntityDatabaseStorage class, - * adding required special handling for feed entities. + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, adding + * required special handling for feed entities. */ -class FeedStorage extends ContentEntityDatabaseStorage implements FeedStorageInterface { +class FeedStorage extends SqlContentEntityStorage implements FeedStorageInterface { /** * {@inheritdoc} diff --git a/core/modules/aggregator/src/FeedStorageSchema.php b/core/modules/aggregator/src/FeedStorageSchema.php index 41cfcb1..bb197bc 100644 --- a/core/modules/aggregator/src/FeedStorageSchema.php +++ b/core/modules/aggregator/src/FeedStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\aggregator; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the feed schema handler. diff --git a/core/modules/aggregator/src/ItemStorage.php b/core/modules/aggregator/src/ItemStorage.php index ede7861..8df143c 100644 --- a/core/modules/aggregator/src/ItemStorage.php +++ b/core/modules/aggregator/src/ItemStorage.php @@ -7,16 +7,16 @@ namespace Drupal\aggregator; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Entity\Query\QueryInterface; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * Controller class for aggregators items. * - * This extends the Drupal\Core\Entity\ContentEntityDatabaseStorage class, - * adding required special handling for feed item entities. + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, adding + * required special handling for feed item entities. */ -class ItemStorage extends ContentEntityDatabaseStorage implements ItemStorageInterface { +class ItemStorage extends SqlContentEntityStorage implements ItemStorageInterface { /** * {@inheritdoc} diff --git a/core/modules/aggregator/src/ItemStorageSchema.php b/core/modules/aggregator/src/ItemStorageSchema.php index 3b52c95..ae9af84 100644 --- a/core/modules/aggregator/src/ItemStorageSchema.php +++ b/core/modules/aggregator/src/ItemStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\aggregator; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the item schema handler. diff --git a/core/modules/block_content/src/BlockContentStorageSchema.php b/core/modules/block_content/src/BlockContentStorageSchema.php index 533e5c8..18295d3 100644 --- a/core/modules/block_content/src/BlockContentStorageSchema.php +++ b/core/modules/block_content/src/BlockContentStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\block_content; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the block content schema handler. diff --git a/core/modules/block_content/src/Entity/BlockContent.php b/core/modules/block_content/src/Entity/BlockContent.php index 5e5893d..01b49ec 100644 --- a/core/modules/block_content/src/Entity/BlockContent.php +++ b/core/modules/block_content/src/Entity/BlockContent.php @@ -21,7 +21,7 @@ * label = @Translation("Custom Block"), * bundle_label = @Translation("Custom Block type"), * handlers = { - * "storage" = "Drupal\Core\Entity\ContentEntityDatabaseStorage", + * "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage", * "storage_schema" = "Drupal\block_content\BlockContentStorageSchema", * "access" = "Drupal\block_content\BlockContentAccessControlHandler", * "list_builder" = "Drupal\block_content\BlockContentListBuilder", diff --git a/core/modules/comment/src/CommentStorage.php b/core/modules/comment/src/CommentStorage.php index 843c79f..714b4c1 100644 --- a/core/modules/comment/src/CommentStorage.php +++ b/core/modules/comment/src/CommentStorage.php @@ -9,21 +9,21 @@ use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Connection; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Defines the controller class for comments. * - * This extends the Drupal\Core\Entity\ContentEntityDatabaseStorage class, + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, * adding required special handling for comment entities. */ -class CommentStorage extends ContentEntityDatabaseStorage implements CommentStorageInterface { +class CommentStorage extends SqlContentEntityStorage implements CommentStorageInterface { /** * The current user. diff --git a/core/modules/comment/src/CommentStorageSchema.php b/core/modules/comment/src/CommentStorageSchema.php index 722f576..7b9a03c 100644 --- a/core/modules/comment/src/CommentStorageSchema.php +++ b/core/modules/comment/src/CommentStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\comment; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the comment schema handler. diff --git a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module index 3ef9d22..70311f1 100644 --- a/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module +++ b/core/modules/contact/tests/modules/contact_storage_test/contact_storage_test.module @@ -18,7 +18,7 @@ function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityT ->setDescription(t('The message ID.')) ->setReadOnly(TRUE) // Explicitly set this to 'contact' so that - // ContentEntityDatabaseStorage::usesDedicatedTable() doesn't attempt to + // SqlContentEntityStorage::usesDedicatedTable() doesn't attempt to // put the ID in a dedicated table. // @todo Remove when https://www.drupal.org/node/1498720 is in. ->setProvider('contact') @@ -36,7 +36,7 @@ function contact_storage_test_entity_type_alter(array &$entity_types) { /** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */ // Set the controller class for nodes to an alternate implementation of the // Drupal\Core\Entity\EntityStorageInterface interface. - $entity_types['contact_message']->setStorageClass('\Drupal\Core\Entity\ContentEntityDatabaseStorage'); + $entity_types['contact_message']->setStorageClass('\Drupal\Core\Entity\Sql\SqlContentEntityStorage'); $keys = $entity_types['contact_message']->getKeys(); $keys['id'] = 'id'; $entity_types['contact_message']->set('entity_keys', $keys); diff --git a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php index d831045..4c92719 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationTestBase.php @@ -7,7 +7,7 @@ namespace Drupal\content_translation\Tests; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; @@ -222,7 +222,7 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) { $entity_values[$bundle_key] = $bundle_name ?: $this->bundle; } $controller = $this->container->get('entity.manager')->getStorage($this->entityTypeId); - if (!($controller instanceof ContentEntityDatabaseStorage)) { + if (!($controller instanceof SqlContentEntityStorage)) { foreach ($values as $property => $value) { if (is_array($value)) { $entity_values[$property] = array($langcode => $value); diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index 95e360e..a01ee5c 100644 --- a/core/modules/field/field.views.inc +++ b/core/modules/field/field.views.inc @@ -6,7 +6,7 @@ */ use Drupal\Component\Utility\NestedArray; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\field\FieldStorageConfigInterface; use Drupal\field\FieldInstanceConfigInterface; @@ -63,7 +63,7 @@ function field_views_data_alter(&$data) { * @param \Drupal\field\FieldStorageConfigInterface $field_storage * The field storage definition. * - * @return \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @return \Drupal\Core\Entity\Sql\SqlContentEntityStorage * Returns the entity type storage if supported. */ function _field_views_get_entity_type_storage(FieldStorageConfigInterface $field_storage) { @@ -71,7 +71,7 @@ function _field_views_get_entity_type_storage(FieldStorageConfigInterface $field $entity_manager = \Drupal::entityManager(); if ($entity_manager->hasDefinition($field_storage->getTargetEntityTypeId())) { $storage = $entity_manager->getStorage($field_storage->getTargetEntityTypeId()); - $result = $storage instanceof ContentEntityDatabaseStorage ? $storage : FALSE; + $result = $storage instanceof SqlContentEntityStorage ? $storage : FALSE; } return $result; } diff --git a/core/modules/field/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php index ec5dd88..d41808f 100644 --- a/core/modules/field/src/Tests/FieldAttachOtherTest.php +++ b/core/modules/field/src/Tests/FieldAttachOtherTest.php @@ -160,7 +160,7 @@ function testEntityDisplayViewMultiple() { * Test entity cache. * * Complements unit test coverage in - * \Drupal\Tests\Core\Entity\ContentEntityDatabaseStorageTest. + * \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest. */ function testEntityCache() { // Initialize random values and a test entity. diff --git a/core/modules/field/src/Tests/FieldDataCountTest.php b/core/modules/field/src/Tests/FieldDataCountTest.php index 66e60db..b1d251f 100644 --- a/core/modules/field/src/Tests/FieldDataCountTest.php +++ b/core/modules/field/src/Tests/FieldDataCountTest.php @@ -7,7 +7,7 @@ namespace Drupal\field\Tests; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * Tests counting field data records and the hasData() method on @@ -74,7 +74,7 @@ public function testEntityCountAndHasData() { } $storage = \Drupal::entityManager()->getStorage('entity_test'); - if ($storage instanceof ContentEntityDatabaseStorage) { + if ($storage instanceof SqlContentEntityStorage) { // Count the actual number of rows in the field table. $table_mapping = $storage->getTableMapping(); $field_table_name = $table_mapping->getDedicatedDataTableName($field_storage); diff --git a/core/modules/file/src/FileStorage.php b/core/modules/file/src/FileStorage.php index 10ccd42..872435f 100644 --- a/core/modules/file/src/FileStorage.php +++ b/core/modules/file/src/FileStorage.php @@ -7,12 +7,12 @@ namespace Drupal\file; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * File storage for files. */ -class FileStorage extends ContentEntityDatabaseStorage implements FileStorageInterface { +class FileStorage extends SqlContentEntityStorage implements FileStorageInterface { /** * {@inheritdoc} diff --git a/core/modules/file/src/FileStorageSchema.php b/core/modules/file/src/FileStorageSchema.php index 3e38341..f223e7b 100644 --- a/core/modules/file/src/FileStorageSchema.php +++ b/core/modules/file/src/FileStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\file; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the file schema handler. diff --git a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php index b9796b3..ea3cc30 100644 --- a/core/modules/menu_link_content/src/Entity/MenuLinkContent.php +++ b/core/modules/menu_link_content/src/Entity/MenuLinkContent.php @@ -21,7 +21,7 @@ * id = "menu_link_content", * label = @Translation("Custom menu link"), * handlers = { - * "storage" = "Drupal\Core\Entity\ContentEntityDatabaseStorage", + * "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage", * "access" = "Drupal\menu_link_content\MenuLinkContentAccessControlHandler", * "form" = { * "default" = "Drupal\menu_link_content\Form\MenuLinkContentForm", diff --git a/core/modules/node/src/NodeStorage.php b/core/modules/node/src/NodeStorage.php index 669f200..f851c94 100644 --- a/core/modules/node/src/NodeStorage.php +++ b/core/modules/node/src/NodeStorage.php @@ -7,7 +7,7 @@ namespace Drupal\node; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Language\LanguageInterface; @@ -17,7 +17,7 @@ * This extends the base storage class, adding required special handling for * node entities. */ -class NodeStorage extends ContentEntityDatabaseStorage implements NodeStorageInterface { +class NodeStorage extends SqlContentEntityStorage implements NodeStorageInterface { /** * {@inheritdoc} diff --git a/core/modules/node/src/NodeStorageSchema.php b/core/modules/node/src/NodeStorageSchema.php index b7aa91f..4bd15c0 100644 --- a/core/modules/node/src/NodeStorageSchema.php +++ b/core/modules/node/src/NodeStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\node; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the node schema handler. diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php index f4bbfd2..7b0559c 100644 --- a/core/modules/system/entity.api.php +++ b/core/modules/system/entity.api.php @@ -19,7 +19,7 @@ * entity storage classes; see the * @link entity_api Entity API topic @endlink for more information. Most * entities use or extend the default classes: - * \Drupal\Core\Entity\ContentEntityDatabaseStorage for content entities, and + * \Drupal\Core\Entity\Sql\SqlContentEntityStorage for content entities, and * \Drupal\Core\Config\Entity\ConfigEntityStorage for configuration entities. * For these entities, there is a set of hooks that is invoked for each * CRUD operation, which module developers can implement to affect these @@ -306,7 +306,7 @@ * checkAccess() and checkCreateAccess() methods, not access(). * - storage: A class implementing * \Drupal\Core\Entity\EntityStorageInterface. If not specified, content - * entities will use \Drupal\Core\Entity\ContentEntityDatabaseStorage, and + * entities will use \Drupal\Core\Entity\Sql\SqlContentEntityStorage, and * config entities will use \Drupal\Core\Config\Entity\ConfigEntityStorage. * You can extend one of these classes to provide custom behavior. * - views_data: A class implementing \Drupal\views\EntityViewsDataInterface diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php index d3df71c..6610958 100644 --- a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php +++ b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php @@ -8,7 +8,7 @@ namespace Drupal\system\Tests\Entity; use Drupal\Core\Database\Database; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; use Drupal\field\Entity\FieldStorageConfig; @@ -466,7 +466,7 @@ function testFieldSqlStorageForeignKeys() { $this->assertEqual($schema['foreign keys'][$foreign_key_name]['columns'][$foreign_key_name], 'id', 'Foreign key column name modified after update'); // Verify the SQL schema. - $schemas = ContentEntityDatabaseStorage::_fieldSqlSchema($field_storage); + $schemas = SqlContentEntityStorage::_fieldSqlSchema($field_storage); $schema = $schemas[$this->table_mapping->getDedicatedDataTableName($field_storage)]; $this->assertEqual(count($schema['foreign keys']), 1, 'There is 1 foreign key in the schema'); $foreign_key = reset($schema['foreign keys']); diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php index b746a2d..20033ba 100644 --- a/core/modules/taxonomy/src/TermStorage.php +++ b/core/modules/taxonomy/src/TermStorage.php @@ -7,14 +7,14 @@ namespace Drupal\taxonomy; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Query\QueryInterface; /** * Defines a Controller class for taxonomy terms. */ -class TermStorage extends ContentEntityDatabaseStorage implements TermStorageInterface { +class TermStorage extends SqlContentEntityStorage implements TermStorageInterface { /** * {@inheritdoc} diff --git a/core/modules/taxonomy/src/TermStorageSchema.php b/core/modules/taxonomy/src/TermStorageSchema.php index 349c87f..83e3457 100644 --- a/core/modules/taxonomy/src/TermStorageSchema.php +++ b/core/modules/taxonomy/src/TermStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\taxonomy; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the term schema handler. diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index d58064d..4701e26 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -6,7 +6,7 @@ */ use Drupal\Component\Utility\Tags; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; @@ -756,7 +756,7 @@ function taxonomy_node_insert(EntityInterface $node) { function taxonomy_build_node_index($node) { // We maintain a denormalized table of term/node relationships, containing // only data for current, published nodes. - if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(\Drupal::entityManager()->getStorage('node') instanceof ContentEntityDatabaseStorage)) { + if (!\Drupal::config('taxonomy.settings')->get('maintain_index_table') || !(\Drupal::entityManager()->getStorage('node') instanceof SqlContentEntityStorage)) { return; } diff --git a/core/modules/user/src/UserStorage.php b/core/modules/user/src/UserStorage.php index eeb8c3b..9aa844e 100644 --- a/core/modules/user/src/UserStorage.php +++ b/core/modules/user/src/UserStorage.php @@ -8,11 +8,11 @@ namespace Drupal\user; use Drupal\Core\Database\Connection; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Password\PasswordInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -20,10 +20,10 @@ /** * Controller class for users. * - * This extends the Drupal\Core\Entity\ContentEntityDatabaseStorage class, + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, * adding required special handling for user objects. */ -class UserStorage extends ContentEntityDatabaseStorage implements UserStorageInterface { +class UserStorage extends SqlContentEntityStorage implements UserStorageInterface { /** * Provides the password hashing service object. diff --git a/core/modules/user/src/UserStorageSchema.php b/core/modules/user/src/UserStorageSchema.php index 494e9f0..0229db2 100644 --- a/core/modules/user/src/UserStorageSchema.php +++ b/core/modules/user/src/UserStorageSchema.php @@ -8,7 +8,7 @@ namespace Drupal\user; use Drupal\Core\Entity\ContentEntityTypeInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; /** * Defines the user schema handler. diff --git a/core/modules/views/src/Tests/QueryGroupByTest.php b/core/modules/views/src/Tests/QueryGroupByTest.php index 05de2b7..b6132fc 100644 --- a/core/modules/views/src/Tests/QueryGroupByTest.php +++ b/core/modules/views/src/Tests/QueryGroupByTest.php @@ -33,7 +33,7 @@ class QueryGroupByTest extends ViewUnitTestBase { /** * The storage for the test entity type. * - * @var \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ public $storage; diff --git a/core/tests/Drupal/Tests/Core/Entity/Schema/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php similarity index 98% rename from core/tests/Drupal/Tests/Core/Entity/Schema/SqlContentEntityStorageSchemaTest.php rename to core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php index d404b58..3109adc 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Schema/SqlContentEntityStorageSchemaTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -2,18 +2,18 @@ /** * @file - * Contains \Drupal\Tests\Core\Entity\Schema\SqlContentEntityStorageSchemaTest. + * Contains \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageSchemaTest. */ -namespace Drupal\Tests\Core\Entity\Schema; +namespace Drupal\Tests\Core\Entity\Sql; use Drupal\Core\Entity\ContentEntityType; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; use Drupal\Core\Entity\Sql\DefaultTableMapping; use Drupal\Tests\UnitTestCase; /** - * @coversDefaultClass \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema + * @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema * @group Entity */ class SqlContentEntityStorageSchemaTest extends UnitTestCase { @@ -35,7 +35,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { /** * The mocked SQL storage used in this test. * - * @var \Drupal\Core\Entity\ContentEntityDatabaseStorage|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage|\PHPUnit_Framework_MockObject_MockObject */ protected $storage; @@ -49,7 +49,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { /** * The content entity schema handler used in this test. * - * @var \Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema. + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema. */ protected $schemaHandler; @@ -58,7 +58,7 @@ class SqlContentEntityStorageSchemaTest extends UnitTestCase { */ protected function setUp() { $this->entityManager = $this->getMock('Drupal\Core\Entity\EntityManagerInterface'); - $this->storage = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityDatabaseStorage') + $this->storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php similarity index 95% rename from core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php rename to core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index 80b48c8..57aa2c3 100644 --- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityDatabaseStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -2,31 +2,31 @@ /** * @file - * Contains \Drupal\Tests\Core\Entity\ContentEntityDatabaseStorageTest. + * Contains \Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTest. */ -namespace Drupal\Tests\Core\Entity; +namespace Drupal\Tests\Core\Entity\Sql; use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Entity\ContentEntityDatabaseStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Entity\Schema\SqlContentEntityStorageSchema; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Language\Language; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; /** - * @coversDefaultClass \Drupal\Core\Entity\ContentEntityDatabaseStorage + * @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @group Entity */ -class ContentEntityDatabaseStorageTest extends UnitTestCase { +class SqlContentEntityStorageTest extends UnitTestCase { /** * The content entity database storage used in this test. * - * @var \Drupal\Core\Entity\ContentEntityDatabaseStorage|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage|\PHPUnit_Framework_MockObject_MockObject */ protected $entityStorage; @@ -107,13 +107,13 @@ protected function setUp() { } /** - * Tests ContentEntityDatabaseStorage::getBaseTable(). + * Tests SqlContentEntityStorage::getBaseTable(). * * @param string $base_table * The base table to be returned by the mocked entity type. * @param string $expected * The expected return value of - * ContentEntityDatabaseStorage::getBaseTable(). + * SqlContentEntityStorage::getBaseTable(). * * @covers ::__construct() * @covers ::getBaseTable() @@ -136,7 +136,7 @@ public function testGetBaseTable($base_table, $expected) { * @return array[] * An nested array where each inner array has the base table to be returned * by the mocked entity type as the first value and the expected return - * value of ContentEntityDatabaseStorage::getBaseTable() as the second + * value of SqlContentEntityStorage::getBaseTable() as the second * value. */ public function providerTestGetBaseTable() { @@ -149,13 +149,13 @@ public function providerTestGetBaseTable() { } /** - * Tests ContentEntityDatabaseStorage::getRevisionTable(). + * Tests SqlContentEntityStorage::getRevisionTable(). * * @param string $revision_table * The revision table to be returned by the mocked entity type. * @param string $expected * The expected return value of - * ContentEntityDatabaseStorage::getRevisionTable(). + * SqlContentEntityStorage::getRevisionTable(). * * @cover ::__construct() * @covers ::getRevisionTable() @@ -181,7 +181,7 @@ public function testGetRevisionTable($revision_table, $expected) { * @return array[] * An nested array where each inner array has the revision table to be * returned by the mocked entity type as the first value and the expected - * return value of ContentEntityDatabaseStorage::getRevisionTable() as the + * return value of SqlContentEntityStorage::getRevisionTable() as the * second value. */ public function providerTestGetRevisionTable() { @@ -195,7 +195,7 @@ public function providerTestGetRevisionTable() { } /** - * Tests ContentEntityDatabaseStorage::getDataTable(). + * Tests SqlContentEntityStorage::getDataTable(). * * @cover ::__construct() * @covers ::getDataTable() @@ -214,13 +214,13 @@ public function testGetDataTable() { } /** - * Tests ContentEntityDatabaseStorage::getRevisionDataTable(). + * Tests SqlContentEntityStorage::getRevisionDataTable(). * * @param string $revision_data_table * The revision data table to be returned by the mocked entity type. * @param string $expected * The expected return value of - * ContentEntityDatabaseStorage::getRevisionDataTable(). + * SqlContentEntityStorage::getRevisionDataTable(). * * @cover ::__construct() * @covers ::getRevisionDataTable() @@ -253,7 +253,7 @@ public function testGetRevisionDataTable($revision_data_table, $expected) { * @return array[] * An nested array where each inner array has the revision data table to be * returned by the mocked entity type as the first value and the expected - * return value of ContentEntityDatabaseStorage::getRevisionDataTable() as + * return value of SqlContentEntityStorage::getRevisionDataTable() as * the second value. */ public function providerTestGetRevisionDataTable() { @@ -336,7 +336,7 @@ public function testOnEntityTypeCreate() { ->method('schema') ->will($this->returnValue($schema_handler)); - $storage = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityDatabaseStorage') + $storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs(array($this->entityType, $this->connection, $this->entityManager, $this->cache)) ->setMethods(array('schemaHandler')) ->getMock(); @@ -991,7 +991,7 @@ public function testFieldSqlSchemaForEntityWithStringIdentifier() { ->method('getSchema') ->will($this->returnValue($field_schema)); - $schema = ContentEntityDatabaseStorage::_fieldSqlSchema($field_storage); + $schema = SqlContentEntityStorage::_fieldSqlSchema($field_storage); // Make sure that the entity_id schema field if of type varchar. $this->assertEquals($schema['test_entity__test_field']['fields']['entity_id']['type'], 'varchar'); @@ -1110,7 +1110,7 @@ protected function setUpEntityStorage() { ->method('getBaseFieldDefinitions') ->will($this->returnValue($this->fieldDefinitions)); - $this->entityStorage = new ContentEntityDatabaseStorage($this->entityType, $this->connection, $this->entityManager, $this->cache); + $this->entityStorage = new SqlContentEntityStorage($this->entityType, $this->connection, $this->entityManager, $this->cache); } /** @@ -1123,7 +1123,7 @@ public function testLoadMultiplePersistentCached() { $key = 'values:' . $this->entityTypeId . ':1'; $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\ContentEntityDatabaseStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1163,7 +1163,7 @@ public function testLoadMultipleNoPersistentCache() { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\ContentEntityDatabaseStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1186,7 +1186,7 @@ public function testLoadMultipleNoPersistentCache() { $this->cache->expects($this->never()) ->method('set'); - $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityDatabaseStorage') + $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs(array($this->entityType, $this->connection, $this->entityManager, $this->cache)) ->setMethods(array('getFromStorage')) ->getMock(); @@ -1209,7 +1209,7 @@ public function testLoadMultiplePersistentCacheMiss() { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\ContentEntityDatabaseStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1236,7 +1236,7 @@ public function testLoadMultiplePersistentCacheMiss() { ->method('set') ->with($key, $entity, CacheBackendInterface::CACHE_PERMANENT, array($this->entityTypeId . '_values' => TRUE, 'entity_field_info' => TRUE)); - $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\ContentEntityDatabaseStorage') + $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs(array($this->entityType, $this->connection, $this->entityManager, $this->cache)) ->setMethods(array('getFromStorage')) ->getMock(); @@ -1269,7 +1269,7 @@ protected function setUpModuleHandlerNoImplementations() { * Provides an entity with dummy implementations of static methods, because * those cannot be mocked. */ -abstract class ContentEntityDatabaseStorageTestEntityInterface implements EntityInterface { +abstract class SqlContentEntityStorageTestEntityInterface implements EntityInterface { /** * {@inheritdoc}