Issue #2330091 by plach: Rename ContentEntityDatabaseStorage to SqlContentEntityStorage.

8.0.x
Nathaniel Catchpole 2014-09-08 13:12:45 +01:00
parent edafea1f78
commit 71d247919f
34 changed files with 114 additions and 109 deletions

View File

@ -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) {

View File

@ -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',
);
}

View File

@ -11,7 +11,7 @@ namespace Drupal\Core\Entity;
* 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.

View File

@ -535,7 +535,7 @@ interface EntityTypeInterface {
/**
* 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 @@ interface EntityTypeInterface {
/**
* 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 @@ interface EntityTypeInterface {
/**
* 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 @@ interface EntityTypeInterface {
/**
* 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.

View File

@ -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 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
* 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 @@ class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements S
}
/**
* Constructs a ContentEntityDatabaseStorage object.
* Constructs a SqlContentEntityStorage object.
*
* @param \Drupal\Core\Entity\EntityTypeInterface $entity_type
* The entity type definition.
@ -220,12 +225,12 @@ class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements S
/**
* 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 @@ class ContentEntityDatabaseStorage extends ContentEntityStorageBase implements S
* @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;

View File

@ -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;

View File

@ -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}

View File

@ -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.

View File

@ -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}

View File

@ -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.

View File

@ -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.

View File

@ -21,7 +21,7 @@ use Drupal\block_content\BlockContentInterface;
* 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",

View File

@ -9,21 +9,21 @@ namespace Drupal\comment;
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.

View File

@ -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.

View File

@ -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);

View File

@ -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 @@ abstract class ContentTranslationTestBase extends WebTestBase {
$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);

View File

@ -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;
}

View File

@ -160,7 +160,7 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
* 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.

View File

@ -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 @@ class FieldDataCountTest extends FieldUnitTestBase {
}
$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);

View File

@ -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}

View File

@ -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.

View File

@ -21,7 +21,7 @@ use Drupal\menu_link_content\MenuLinkContentInterface;
* 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",

View File

@ -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 @@ use Drupal\Core\Language\LanguageInterface;
* 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}

View File

@ -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.

View File

@ -19,7 +19,7 @@ use Drupal\Core\Render\Element;
* 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 @@ use Drupal\Core\Render\Element;
* 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

View File

@ -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 @@ class FieldSqlStorageTest extends EntityUnitTestBase {
$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']);

View File

@ -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}

View File

@ -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.

View File

@ -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;
}

View File

@ -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 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* 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.

View File

@ -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.

View File

@ -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;

View File

@ -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();

View File

@ -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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
}
/**
* 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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
* @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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
}
/**
* 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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
* @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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
}
/**
* Tests ContentEntityDatabaseStorage::getDataTable().
* Tests SqlContentEntityStorage::getDataTable().
*
* @cover ::__construct()
* @covers ::getDataTable()
@ -214,13 +214,13 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
}
/**
* 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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
* @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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
->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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
->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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
->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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
$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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
$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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
$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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
$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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
->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 @@ class ContentEntityDatabaseStorageTest extends UnitTestCase {
* 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}