diff --git a/core/includes/entity.inc b/core/includes/entity.inc index 6eeb6a4..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\SqlContentEntityStorage + * @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\SqlContentEntityStorage + * @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\SqlContentEntityStorage 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\SqlContentEntityStorage 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\SqlContentEntityStorage + * @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 9074adc..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\SqlContentEntityStorage', + 'storage' => 'Drupal\Core\Entity\Sql\SqlContentEntityStorage', ); } diff --git a/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php deleted file mode 100644 index b55736d..0000000 --- a/core/lib/Drupal/Core/Entity/EntityDatabaseStorage.php +++ /dev/null @@ -1,212 +0,0 @@ -get('database'), - $container->get('uuid') - ); - } - - /** - * Constructs a EntityDatabaseStorage object. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * The entity type definition. - * @param \Drupal\Core\Database\Connection $database - * The database connection to be used. - * @param \Drupal\Component\Uuid\UuidInterface $uuid_service - * The UUID service. - */ - public function __construct(EntityTypeInterface $entity_type, Connection $database, UuidInterface $uuid_service) { - parent::__construct($entity_type); - - $this->database = $database; - $this->uuidService = $uuid_service; - - // Check if the entity type supports UUIDs. - $this->uuidKey = $this->entityType->getKey('uuid'); - } - - /** - * {@inheritdoc} - */ - protected function doLoadMultiple(array $ids = NULL) { - // Build and execute the query. - $records = $this - ->buildQuery($ids) - ->execute() - ->fetchAllAssoc($this->idKey, \PDO::FETCH_ASSOC); - - return $this->mapFromStorageRecords($records); - } - - /** - * {@inheritdoc} - */ - public function loadRevision($revision_id) { - throw new \Exception('Database storage does not support revisions.'); - } - - /** - * {@inheritdoc} - */ - public function deleteRevision($revision_id) { - throw new \Exception('Database storage does not support revisions.'); - } - - /** - * Builds the query to load the entity. - * - * @param array|null $ids - * An array of entity IDs, or NULL to load all entities. - * - * @return \Drupal\Core\Database\Query\Select - * A SelectQuery object for loading the entity. - */ - protected function buildQuery($ids) { - $query = $this->database->select($this->entityType->getBaseTable(), 'base'); - - $query->addTag($this->entityTypeId . '_load_multiple'); - - // Add fields from the {entity} table. - $entity_fields = drupal_schema_fields_sql($this->entityType->getBaseTable()); - $query->fields('base', $entity_fields); - - if ($ids) { - $query->condition("base.{$this->idKey}", $ids, 'IN'); - } - - return $query; - } - - /** - * {@inheritdoc} - */ - public function delete(array $entities) { - if (!$entities) { - // If no IDs or invalid IDs were passed, do nothing. - return; - } - $transaction = $this->database->startTransaction(); - - try { - parent::delete($entities); - - // Ignore replica server temporarily. - db_ignore_replica(); - } - catch (\Exception $e) { - $transaction->rollback(); - watchdog_exception($this->entityTypeId, $e); - throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); - } - } - - /** - * {@inheritdoc} - */ - protected function doDelete($entities) { - $ids = array_keys($entities); - - $this->database->delete($this->entityType->getBaseTable()) - ->condition($this->idKey, $ids, 'IN') - ->execute(); - - // Reset the cache as soon as the changes have been applied. - $this->resetCache($ids); - } - - /** - * {@inheritdoc} - */ - public function save(EntityInterface $entity) { - $transaction = $this->database->startTransaction(); - try { - $return = parent::save($entity); - - // Ignore replica server temporarily. - db_ignore_replica(); - return $return; - } - catch (\Exception $e) { - $transaction->rollback(); - watchdog_exception($this->entityTypeId, $e); - throw new EntityStorageException($e->getMessage(), $e->getCode(), $e); - } - } - - /** - * {@inheritdoc} - */ - protected function doSave($id, EntityInterface $entity) { - if (!$entity->isNew()) { - $return = drupal_write_record($this->entityType->getBaseTable(), $entity, $this->idKey); - $this->resetCache(array($entity->id())); - } - else { - $return = drupal_write_record($this->entityType->getBaseTable(), $entity); - // Reset general caches, but keep caches specific to certain entities. - $this->resetCache(array()); - } - - return $return; - } - - /** - * {@inheritdoc} - */ - protected function has($id, EntityInterface $entity) { - return !$entity->isNew(); - } - - /** - * {@inheritdoc} - */ - public function getQueryServiceName() { - return 'entity.query.sql'; - } - -} diff --git a/core/lib/Drupal/Core/Entity/EntityStorageInterface.php b/core/lib/Drupal/Core/Entity/EntityStorageInterface.php index 2bd29c5..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\SqlContentEntityStorage 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/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php similarity index 98% rename from core/lib/Drupal/Core/Entity/SqlContentEntityStorage.php rename to core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php index 93384b4..0236e7d 100644 --- a/core/lib/Drupal/Core/Entity/SqlContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php @@ -2,19 +2,23 @@ /** * @file - * Contains \Drupal\Core\Entity\SqlContentEntityStorage. + * 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\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,7 +30,7 @@ * 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 * SqlContentEntityStorage::getSchema() to customize the generated @@ -227,12 +231,12 @@ public function getSchema() { /** * 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); } return $this->schemaHandler; @@ -1023,8 +1027,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 1881454..cac943c 100644 --- a/core/lib/Drupal/Core/Entity/Schema/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -2,14 +2,14 @@ /** * @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\Entity\SqlContentEntityStorage; use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityManagerInterface; +use Drupal\Core\Entity\Schema\EntitySchemaHandlerInterface; /** * Defines a schema handler that supports revisionable, translatable entities. @@ -33,7 +33,7 @@ class SqlContentEntityStorageSchema implements EntitySchemaHandlerInterface { /** * The storage object for the given entity type. * - * @var \Drupal\Core\Entity\SqlContentEntityStorage + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage */ protected $storage; @@ -51,7 +51,7 @@ class SqlContentEntityStorageSchema implements EntitySchemaHandlerInterface { * The entity manager. * @param \Drupal\Core\Entity\ContentEntityTypeInterface $entity_type * The entity type. - * @param \Drupal\Core\Entity\SqlContentEntityStorage $storage + * @param \Drupal\Core\Entity\Sql\SqlContentEntityStorage $storage * The storage of the entity type. This must be an SQL-based storage. */ public function __construct(EntityManagerInterface $entity_manager, ContentEntityTypeInterface $entity_type, SqlContentEntityStorage $storage) { diff --git a/core/modules/aggregator/src/FeedStorage.php b/core/modules/aggregator/src/FeedStorage.php index 9a9138e..9017974 100644 --- a/core/modules/aggregator/src/FeedStorage.php +++ b/core/modules/aggregator/src/FeedStorage.php @@ -7,13 +7,13 @@ namespace Drupal\aggregator; -use Drupal\Core\Entity\SqlContentEntityStorage; +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 SqlContentEntityStorage implements FeedStorageInterface { 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 ff46e8d..8df143c 100644 --- a/core/modules/aggregator/src/ItemStorage.php +++ b/core/modules/aggregator/src/ItemStorage.php @@ -8,13 +8,13 @@ namespace Drupal\aggregator; use Drupal\Core\Entity\Query\QueryInterface; -use Drupal\Core\Entity\SqlContentEntityStorage; +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 SqlContentEntityStorage implements ItemStorageInterface { 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 91b6947..714b4c1 100644 --- a/core/modules/comment/src/CommentStorage.php +++ b/core/modules/comment/src/CommentStorage.php @@ -13,14 +13,14 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\SqlContentEntityStorage; +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\SqlContentEntityStorage class, + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, * adding required special handling for comment entities. */ class CommentStorage extends SqlContentEntityStorage implements CommentStorageInterface { 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 b987bc6..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 @@ -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\SqlContentEntityStorage'); + $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 463a294..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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Language\Language; use Drupal\simpletest\WebTestBase; diff --git a/core/modules/field/field.views.inc b/core/modules/field/field.views.inc index 3f14b19..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\SqlContentEntityStorage; +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\SqlContentEntityStorage + * @return \Drupal\Core\Entity\Sql\SqlContentEntityStorage * Returns the entity type storage if supported. */ function _field_views_get_entity_type_storage(FieldStorageConfigInterface $field_storage) { diff --git a/core/modules/field/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php index 18ad2f2..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\SqlContentEntityStorageTest. + * \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 36c485c..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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * Tests counting field data records and the hasData() method on diff --git a/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php b/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php index be18202..7aeceb6 100644 --- a/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php +++ b/core/modules/field_ui/tests/modules/field_ui_test/src/Entity/FieldUITestNoBundle.php @@ -16,7 +16,7 @@ * id = "field_ui_test_no_bundle", * label = @Translation("Test Field UI entity, no bundle"), * handlers = { - * "storage" = "Drupal\Core\Entity\EntityDatabaseStorage" + * "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage" * }, * fieldable = TRUE * ) diff --git a/core/modules/file/src/FileStorage.php b/core/modules/file/src/FileStorage.php index 1abe1b2..872435f 100644 --- a/core/modules/file/src/FileStorage.php +++ b/core/modules/file/src/FileStorage.php @@ -7,7 +7,7 @@ namespace Drupal\file; -use Drupal\Core\Entity\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; /** * File storage for files. 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 f56be94..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\SqlContentEntityStorage", + * "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 94f7092..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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Language\LanguageInterface; 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 719e243..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\SqlContentEntityStorage 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\SqlContentEntityStorage, 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/EntityApiInfoTest.php b/core/modules/system/src/Tests/Entity/EntityApiInfoTest.php index 8b48f95..dab64bd 100644 --- a/core/modules/system/src/Tests/Entity/EntityApiInfoTest.php +++ b/core/modules/system/src/Tests/Entity/EntityApiInfoTest.php @@ -48,6 +48,6 @@ function testEntityInfoCacheModulesEnabled() { \Drupal::moduleHandler()->install(array('entity_cache_test')); $entity_type = \Drupal::state()->get('entity_cache_test'); $this->assertEqual($entity_type->getLabel(), 'Entity Cache Test', 'Entity info label is correct.'); - $this->assertEqual($entity_type->getStorageClass(), 'Drupal\Core\Entity\EntityDatabaseStorage', 'Entity handler class info is correct.'); + $this->assertEqual($entity_type->getStorageClass(), 'Drupal\Core\Entity\Sql\SqlContentEntityStorage', 'Entity handler class info is correct.'); } } diff --git a/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php b/core/modules/system/src/Tests/Entity/FieldSqlStorageTest.php index 8ec277c..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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; use Drupal\field\Entity\FieldStorageConfig; diff --git a/core/modules/system/tests/modules/entity_cache_test_dependency/src/Entity/EntityCacheTest.php b/core/modules/system/tests/modules/entity_cache_test_dependency/src/Entity/EntityCacheTest.php index 4c9c243..38a0da8 100644 --- a/core/modules/system/tests/modules/entity_cache_test_dependency/src/Entity/EntityCacheTest.php +++ b/core/modules/system/tests/modules/entity_cache_test_dependency/src/Entity/EntityCacheTest.php @@ -16,7 +16,7 @@ * id = "entity_cache_test", * label = @Translation("Entity cache test"), * handlers = { - * "storage" = "Drupal\Core\Entity\EntityDatabaseStorage", + * "storage" = "Drupal\Core\Entity\Sql\SqlContentEntityStorage", * } * ) */ diff --git a/core/modules/taxonomy/src/TermStorage.php b/core/modules/taxonomy/src/TermStorage.php index 4f99461..20033ba 100644 --- a/core/modules/taxonomy/src/TermStorage.php +++ b/core/modules/taxonomy/src/TermStorage.php @@ -7,7 +7,7 @@ namespace Drupal\taxonomy; -use Drupal\Core\Entity\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Query\QueryInterface; 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 54781a5..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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element; diff --git a/core/modules/user/src/UserStorage.php b/core/modules/user/src/UserStorage.php index da4da3c..9aa844e 100644 --- a/core/modules/user/src/UserStorage.php +++ b/core/modules/user/src/UserStorage.php @@ -12,7 +12,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Password\PasswordInterface; use Drupal\Core\Session\AccountInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -20,7 +20,7 @@ /** * Controller class for users. * - * This extends the Drupal\Core\Entity\SqlContentEntityStorage class, + * This extends the Drupal\Core\Entity\Sql\SqlContentEntityStorage class, * adding required special handling for user objects. */ class UserStorage extends SqlContentEntityStorage implements UserStorageInterface { 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 a9b864f..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\SqlContentEntityStorage + * @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 48ba25e..e9f99c3 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\SqlContentEntityStorage|\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\SqlContentEntityStorage') + $this->storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->disableOriginalConstructor() ->getMock(); diff --git a/core/tests/Drupal/Tests/Core/Entity/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php similarity index 98% rename from core/tests/Drupal/Tests/Core/Entity/SqlContentEntityStorageTest.php rename to core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index 92d1eb6..0474880 100644 --- a/core/tests/Drupal/Tests/Core/Entity/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains \Drupal\Tests\Core\Entity\SqlContentEntityStorageTest. + * 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\SqlContentEntityStorage; +use Drupal\Core\Entity\Sql\SqlContentEntityStorage; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Field\BaseFieldDefinition; @@ -17,7 +17,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; /** - * @coversDefaultClass \Drupal\Core\Entity\SqlContentEntityStorage + * @coversDefaultClass \Drupal\Core\Entity\Sql\SqlContentEntityStorage * @group Entity */ class SqlContentEntityStorageTest extends UnitTestCase { @@ -25,7 +25,7 @@ class SqlContentEntityStorageTest extends UnitTestCase { /** * The content entity database storage used in this test. * - * @var \Drupal\Core\Entity\SqlContentEntityStorage|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Entity\Sql\SqlContentEntityStorage|\PHPUnit_Framework_MockObject_MockObject */ protected $entityStorage; @@ -1099,7 +1099,7 @@ public function testLoadMultiplePersistentCached() { $key = 'values:' . $this->entityTypeId . ':1'; $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\SqlContentEntityStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1139,7 +1139,7 @@ public function testLoadMultipleNoPersistentCache() { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\SqlContentEntityStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1162,7 +1162,7 @@ public function testLoadMultipleNoPersistentCache() { $this->cache->expects($this->never()) ->method('set'); - $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\SqlContentEntityStorage') + $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs(array($this->entityType, $this->connection, $this->entityManager, $this->cache)) ->setMethods(array('getFromStorage')) ->getMock(); @@ -1185,7 +1185,7 @@ public function testLoadMultiplePersistentCacheMiss() { $this->setUpModuleHandlerNoImplementations(); $id = 1; - $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\SqlContentEntityStorageTestEntityInterface') + $entity = $this->getMockBuilder('\Drupal\Tests\Core\Entity\Sql\SqlContentEntityStorageTestEntityInterface') ->getMockForAbstractClass(); $entity->expects($this->any()) ->method('id') @@ -1212,7 +1212,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\SqlContentEntityStorage') + $entity_storage = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorage') ->setConstructorArgs(array($this->entityType, $this->connection, $this->entityManager, $this->cache)) ->setMethods(array('getFromStorage')) ->getMock();