Commit 54593549 authored by catch's avatar catch

Issue #2095399 by Berdir: Merge DatabaseStorageController and DatabaseStorageControllerNG.

parent d453e34e
......@@ -136,23 +136,6 @@ protected function cacheSet($entities) {
}
}
/**
* {@inheritdoc}
*/
public function invokeFieldMethod($method, EntityInterface $entity) {
// Only act on content entities.
if (!($entity instanceof ContentEntityInterface)) {
return;
}
foreach (array_keys($entity->getTranslationLanguages()) as $langcode) {
$translation = $entity->getTranslation($langcode);
foreach ($translation as $field) {
$field->$method();
}
}
}
/**
* Invokes a hook on behalf of the entity.
*
......@@ -169,30 +152,4 @@ protected function invokeHook($hook, EntityInterface $entity) {
module_invoke_all('entity_' . $hook, $entity, $this->entityType);
}
/**
* Checks translation statuses and invoke the related hooks if needed.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity being saved.
*/
protected function invokeTranslationHooks(EntityInterface $entity) {
// Only act on content entities.
if (!($entity instanceof ContentEntityInterface)) {
return;
}
$translations = $entity->getTranslationLanguages(FALSE);
$original_translations = $entity->original->getTranslationLanguages(FALSE);
$all_translations = array_keys($translations + $original_translations);
// Notify modules of translation insertion/deletion.
foreach ($all_translations as $langcode) {
if (isset($translations[$langcode]) && !isset($original_translations[$langcode])) {
$this->invokeHook('translation_insert', $entity->getTranslation($langcode));
}
elseif (!isset($translations[$langcode]) && isset($original_translations[$langcode])) {
$this->invokeHook('translation_delete', $entity->getTranslation($langcode));
}
}
}
}
......@@ -153,14 +153,4 @@ public function save(EntityInterface $entity);
*/
public function getQueryServicename();
/**
* Invokes a method on the Field objects within an entity.
*
* @param string $method
* The method name.
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
*/
public function invokeFieldMethod($method, EntityInterface $entity);
}
......@@ -303,4 +303,43 @@ public function onFieldItemsPurge(EntityInterface $entity, FieldInstanceInterfac
*/
public function onFieldPurge(FieldInterface $field) { }
/**
* Checks translation statuses and invoke the related hooks if needed.
*
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity being saved.
*/
protected function invokeTranslationHooks(ContentEntityInterface $entity) {
$translations = $entity->getTranslationLanguages(FALSE);
$original_translations = $entity->original->getTranslationLanguages(FALSE);
$all_translations = array_keys($translations + $original_translations);
// Notify modules of translation insertion/deletion.
foreach ($all_translations as $langcode) {
if (isset($translations[$langcode]) && !isset($original_translations[$langcode])) {
$this->invokeHook('translation_insert', $entity->getTranslation($langcode));
}
elseif (!isset($translations[$langcode]) && isset($original_translations[$langcode])) {
$this->invokeHook('translation_delete', $entity->getTranslation($langcode));
}
}
}
/**
* Invokes a method on the Field objects within an entity.
*
* @param string $method
* The method name.
* @param \Drupal\Core\Entity\ContentEntityInterface $entity
* The entity object.
*/
protected function invokeFieldMethod($method, ContentEntityInterface $entity) {
foreach (array_keys($entity->getTranslationLanguages()) as $langcode) {
$translation = $entity->getTranslation($langcode);
foreach ($translation as $field) {
$field->$method();
}
}
}
}
......@@ -9,7 +9,7 @@
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\Plugin\DataType\EntityReference;
use Drupal\Core\Entity\Query\QueryException;
use Drupal\field\Entity\Field;
......@@ -163,7 +163,7 @@ public function addField($field, $type, $langcode) {
$column = 'value';
}
$table = $this->ensureFieldTable($index_prefix, $field, $type, $langcode, $base_table, $entity_id_field, $field_id_field);
$sql_column = DatabaseStorageController::_fieldColumnName($field, $column);
$sql_column = FieldableDatabaseStorageController::_fieldColumnName($field, $column);
}
// This is an entity property (non-configurable field).
else {
......@@ -251,7 +251,7 @@ protected function ensureEntityTable($index_prefix, $property, $type, $langcode,
protected function ensureFieldTable($index_prefix, &$field, $type, $langcode, $base_table, $entity_id_field, $field_id_field) {
$field_name = $field->getFieldName();
if (!isset($this->fieldTables[$index_prefix . $field_name])) {
$table = $this->sqlQuery->getMetaData('age') == EntityStorageControllerInterface::FIELD_LOAD_CURRENT ? DatabaseStorageController::_fieldTableName($field) : DatabaseStorageController::_fieldRevisionTableName($field);
$table = $this->sqlQuery->getMetaData('age') == EntityStorageControllerInterface::FIELD_LOAD_CURRENT ? FieldableDatabaseStorageController::_fieldTableName($field) : FieldableDatabaseStorageController::_fieldRevisionTableName($field);
if ($field->getFieldCardinality() != 1) {
$this->sqlQuery->addMetaData('simple_query', FALSE);
}
......
......@@ -7,7 +7,7 @@
namespace Drupal\aggregator;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\aggregator\Entity\Feed;
use Drupal\Core\Entity\EntityInterface;
......@@ -17,7 +17,7 @@
* This extends the Drupal\Core\Entity\DatabaseStorageController class, adding
* required special handling for feed entities.
*/
class FeedStorageController extends DatabaseStorageControllerNG implements FeedStorageControllerInterface {
class FeedStorageController extends FieldableDatabaseStorageController implements FeedStorageControllerInterface {
/**
* Overrides Drupal\Core\Entity\DataBaseStorageController::attachLoad().
......
......@@ -10,7 +10,7 @@
use Drupal\aggregator\Entity\Item;
use Drupal\Core\Database\Query\PagerSelectExtender;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
/**
* Controller class for aggregators items.
......@@ -18,7 +18,7 @@
* This extends the Drupal\Core\Entity\DatabaseStorageController class, adding
* required special handling for feed item entities.
*/
class ItemStorageController extends DatabaseStorageControllerNG implements ItemStorageControllerInterface {
class ItemStorageController extends FieldableDatabaseStorageController implements ItemStorageControllerInterface {
/**
* Overrides Drupal\Core\Entity\DataBaseStorageController::attachLoad().
......
......@@ -7,16 +7,16 @@
namespace Drupal\custom_block;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityStorageControllerInterface;
/**
* Controller class for custom blocks.
*
* This extends the Drupal\Core\Entity\DatabaseStorageControllerNG class,
* This extends the Drupal\Core\Entity\DatabaseStorageController class,
* adding required special handling for custom block entities.
*/
class CustomBlockStorageController extends DatabaseStorageControllerNG {
class CustomBlockStorageController extends FieldableDatabaseStorageController {
/**
* Overrides \Drupal\Core\Entity\DatabaseStorageController::attachLoad().
......
......@@ -8,7 +8,7 @@
namespace Drupal\comment;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityChangedInterface;
/**
......@@ -17,7 +17,7 @@
* This extends the Drupal\Core\Entity\DatabaseStorageController class, adding
* required special handling for comment entities.
*/
class CommentStorageController extends DatabaseStorageControllerNG implements CommentStorageControllerInterface {
class CommentStorageController extends FieldableDatabaseStorageController implements CommentStorageControllerInterface {
/**
* The thread for which a lock was acquired.
......
......@@ -18,7 +18,7 @@
* label = @Translation("Contact message"),
* module = "contact",
* controllers = {
* "storage" = "Drupal\Core\Entity\DatabaseStorageControllerNG",
* "storage" = "Drupal\Core\Entity\FieldableDatabaseStorageController",
* "render" = "Drupal\contact\MessageRenderController",
* "form" = {
* "default" = "Drupal\contact\MessageFormController"
......
......@@ -7,7 +7,7 @@
namespace Drupal\contact\Tests\Views;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\views\Tests\ViewTestBase;
/**
......@@ -62,7 +62,7 @@ protected function setUp() {
public function testViewsData() {
// Test that the field is not exposed to views, since contact_message
// entities have no storage.
$table_name = DatabaseStorageController::_fieldTableName($this->field);
$table_name = FieldableDatabaseStorageController::_fieldTableName($this->field);
$data = $this->container->get('views.views_data')->get($table_name);
$this->assertFalse($data, 'The field is not exposed to Views.');
}
......
......@@ -7,7 +7,7 @@
namespace Drupal\content_translation\Tests;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Language\Language;
use Drupal\simpletest\WebTestBase;
......@@ -204,7 +204,7 @@ protected function createEntity($values, $langcode, $bundle_name = NULL) {
$entity_values[$info['entity_keys']['bundle']] = $bundle_name ?: $this->bundle;
}
$controller = $this->container->get('entity.manager')->getStorageController($this->entityType);
if (!($controller instanceof DatabaseStorageControllerNG)) {
if (!($controller instanceof FieldableDatabaseStorageController)) {
foreach ($values as $property => $value) {
if (is_array($value)) {
$entity_values[$property] = array($langcode => $value);
......
......@@ -69,7 +69,7 @@ public static function schema(FieldInterface $field) {
// Create a foreign key to the target entity type base type.
$entity_manager = \Drupal::service('entity.manager');
$target_type = $field->getFieldSetting('target_type');
if (is_subclass_of($entity_manager->getControllerClass($target_type, 'storage'), 'Drupal\Core\Entity\DatabaseStorageController')) {
if (is_subclass_of($entity_manager->getControllerClass($target_type, 'storage'), 'Drupal\Core\Entity\FieldableDatabaseStorageController')) {
$entity_info = $entity_manager->getDefinition($target_type);
$base_table = $entity_info['base_table'];
$schema['foreign keys'][$base_table] = array(
......
......@@ -7,7 +7,7 @@
namespace Drupal\entity_reference\Tests;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\Field\FieldItemListInterface;
use Drupal\Core\Entity\Field\FieldItemInterface;
use Drupal\Core\Language\Language;
......@@ -115,12 +115,12 @@ public function testEntityReferenceFieldSchema() {
$foreign_key_column_name = 'target_id';
// Grab the SQL schema and verify that the 'foreign keys' are present.
$schemas = DatabaseStorageController::_fieldSqlSchema($field);
$schema = $schemas[DatabaseStorageController::_fieldTableName($field)];
$schemas = FieldableDatabaseStorageController::_fieldSqlSchema($field);
$schema = $schemas[FieldableDatabaseStorageController::_fieldTableName($field)];
$this->assertEqual(count($schema['foreign keys']), 1, 'There is 1 foreign key in the schema.');
$foreign_key = reset($schema['foreign keys']);
$foreign_key_column = DatabaseStorageController::_fieldColumnName($field, $foreign_key_column_name);
$foreign_key_column = FieldableDatabaseStorageController::_fieldColumnName($field, $foreign_key_column_name);
$this->assertEqual($foreign_key['table'], 'taxonomy_term_data', 'Foreign key table name preserved in the schema.');
$this->assertEqual($foreign_key['columns'][$foreign_key_column], 'tid', 'Foreign key column name preserved in the schema.');
......@@ -130,8 +130,8 @@ public function testEntityReferenceFieldSchema() {
entity_reference_create_instance('entity_test', 'entity_test', $field_name, 'Test vocabulary reference', 'taxonomy_vocabulary');
$field = field_info_field('entity_test', $field_name);
$schemas = DatabaseStorageController::_fieldSqlSchema($field);
$schema = $schemas[DatabaseStorageController::_fieldTableName($field)];
$schemas = FieldableDatabaseStorageController::_fieldSqlSchema($field);
$schema = $schemas[FieldableDatabaseStorageController::_fieldTableName($field)];
$this->assertFalse(isset($schema['foreign keys']), 'There is no foreign key in the schema.');
}
}
......@@ -5,7 +5,7 @@
* Install, update, and uninstall functions for the Field module.
*/
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\Entity\Field;
/**
......@@ -48,7 +48,7 @@ function _update_8003_field_create_field(array &$field_config) {
// Create storage for the field. This requires a field entity, but cannot use
// the regular entity_create() function here.
$schema = DatabaseStorageController::_fieldSqlSchema(new Field($field_config), $field_config['schema']);
$schema = FieldableDatabaseStorageController::_fieldSqlSchema(new Field($field_config), $field_config['schema']);
foreach ($schema as $name => $table) {
db_create_table($name, $table);
}
......@@ -118,8 +118,8 @@ function _update_8006_field_write_data_sql($entity_type, $bundle, $entity_id, $r
$field_config = \Drupal::config("field.field.$entity_type.$field_name");
$field = new Field($field_config);
$table_name = DatabaseStorageController::_fieldTableName($field);
$revision_name = DatabaseStorageController::_fieldRevisionTableName($field);
$table_name = FieldableDatabaseStorageController::_fieldTableName($field);
$revision_name = FieldableDatabaseStorageController::_fieldRevisionTableName($field);
db_delete($table_name)
->condition('entity_id', $entity_id)
......@@ -140,7 +140,7 @@ function _update_8006_field_write_data_sql($entity_type, $bundle, $entity_id, $r
'langcode' => $langcode,
);
foreach ($item as $column => $value) {
$record[DatabaseStorageController::_fieldColumnName($field_name, $column)] = $value;
$record[FieldableDatabaseStorageController::_fieldColumnName($field_name, $column)] = $value;
}
$records[] = $record;
......@@ -367,8 +367,8 @@ function field_update_8003() {
$field = new Field($config);
// Additionally, rename the data tables for deleted fields.
$tables = array(
"field_deleted_data_{$record['id']}" => 'old_' . DatabaseStorageController::_fieldTableName($field),
"field_deleted_revision_{$record['id']}" => 'old_' . DatabaseStorageController::_fieldRevisionTableName($field),
"field_deleted_data_{$record['id']}" => 'old_' . FieldableDatabaseStorageController::_fieldTableName($field),
"field_deleted_revision_{$record['id']}" => 'old_' . FieldableDatabaseStorageController::_fieldRevisionTableName($field),
);
foreach ($tables as $table_old => $table_new) {
if (db_table_exists($table_old)) {
......@@ -516,7 +516,7 @@ function field_update_8006(&$sandbox) {
$tables = array(
array(
'old_table' => 'field_data_' . $field_config['name'],
'new_table' => DatabaseStorageController::_fieldTableName($field),
'new_table' => FieldableDatabaseStorageController::_fieldTableName($field),
'primary_key' => array(
'entity_id',
'deleted',
......@@ -526,7 +526,7 @@ function field_update_8006(&$sandbox) {
),
array(
'old_table' => 'field_revision_' . $field_config['name'],
'new_table' => DatabaseStorageController::_fieldRevisionTableName($field),
'new_table' => FieldableDatabaseStorageController::_fieldRevisionTableName($field),
'primary_key' => array(
'entity_id',
'revision_id',
......
......@@ -8,7 +8,7 @@
*/
use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\field\FieldInterface;
......@@ -70,7 +70,7 @@ function field_views_data_alter(&$data) {
function _field_views_is_sql_entity_type(FieldInterface $field) {
$entity_manager = \Drupal::entityManager();
try {
if ($entity_manager->getStorageController($field->entity_type) instanceof DatabaseStorageController) {
if ($entity_manager->getStorageController($field->entity_type) instanceof FieldableDatabaseStorageController) {
return TRUE;
}
}
......@@ -148,13 +148,13 @@ function field_views_field_default_views_data(FieldInterface $field) {
// Description of the field tables.
$field_tables = array(
EntityStorageControllerInterface::FIELD_LOAD_CURRENT => array(
'table' => DatabaseStorageController::_fieldTableName($field),
'table' => FieldableDatabaseStorageController::_fieldTableName($field),
'alias' => "{$entity_type}__{$field_name}",
),
);
if ($supports_revisions) {
$field_tables[EntityStorageControllerInterface::FIELD_LOAD_REVISION] = array(
'table' => DatabaseStorageController::_fieldRevisionTableName($field),
'table' => FieldableDatabaseStorageController::_fieldRevisionTableName($field),
'alias' => "{$entity_type}_revision__{$field_name}",
);
}
......@@ -185,7 +185,7 @@ function field_views_field_default_views_data(FieldInterface $field) {
// Build the list of additional fields to add to queries.
$add_fields = array('delta', 'langcode', 'bundle');
foreach (array_keys($field_columns) as $column) {
$add_fields[] = DatabaseStorageController::_fieldColumnName($field, $column);
$add_fields[] = FieldableDatabaseStorageController::_fieldColumnName($field, $column);
}
// Determine the label to use for the field. We don't have a label available
// at the field level, so we just go through all instances and take the one
......@@ -309,10 +309,10 @@ function field_views_field_default_views_data(FieldInterface $field) {
else {
$group = t('@group (historical data)', array('@group' => $group_name));
}
$column_real_name = DatabaseStorageController::_fieldColumnName($field, $column);
$column_real_name = FieldableDatabaseStorageController::_fieldColumnName($field, $column);
// Load all the fields from the table by default.
$field_sql_schema = DatabaseStorageController::_fieldSqlSchema($field);
$field_sql_schema = FieldableDatabaseStorageController::_fieldSqlSchema($field);
$additional_fields = array_keys($field_sql_schema[$table]['fields']);
$data[$table_alias][$column_real_name] = array(
......
......@@ -7,7 +7,7 @@
namespace Drupal\field\Plugin\views\field;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageControllerInterface;
use Drupal\Core\Language\Language;
......@@ -303,7 +303,7 @@ public function clickSort($order) {
$this->ensureMyTable();
$field = field_info_field($this->definition['entity_type'], $this->definition['field_name']);
$column = DatabaseStorageController::_fieldColumnName($field, $this->options['click_sort_column']);
$column = FieldableDatabaseStorageController::_fieldColumnName($field, $this->options['click_sort_column']);
if (!isset($this->aliases[$column])) {
// Column is not in query; add a sort on it (without adding the column).
$this->aliases[$column] = $this->tableAlias . '.' . $column;
......
......@@ -7,7 +7,7 @@
namespace Drupal\field\Tests;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityInterface;
use Drupal\field\FieldInterface;
......@@ -186,9 +186,9 @@ function testDeleteFieldInstance() {
$this->assertEqual($instance->bundle, $bundle, 'The deleted instance is for the correct bundle');
// Check that the actual stored content did not change during delete.
$schema = DatabaseStorageController::_fieldSqlSchema($field);
$table = DatabaseStorageController::_fieldTableName($field);
$column = DatabaseStorageController::_fieldColumnName($field, 'value');
$schema = FieldableDatabaseStorageController::_fieldSqlSchema($field);
$table = FieldableDatabaseStorageController::_fieldTableName($field);
$column = FieldableDatabaseStorageController::_fieldColumnName($field, 'value');
$result = db_select($table, 't')
->fields('t', array_keys($schema[$table]['fields']))
->execute();
......
......@@ -6,7 +6,7 @@
*/
namespace Drupal\field\Tests\Views;
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
/**
* Test the produced views_data.
......@@ -62,8 +62,8 @@ function testViewsData() {
// Check the table and the joins of the first field.
// Attached to node only.
$field = $this->fields[0];
$current_table = DatabaseStorageController::_fieldTableName($field);
$revision_table = DatabaseStorageController::_fieldRevisionTableName($field);
$current_table = FieldableDatabaseStorageController::_fieldTableName($field);
$revision_table = FieldableDatabaseStorageController::_fieldRevisionTableName($field);
$data[$current_table] = $views_data->get($current_table);
$data[$revision_table] = $views_data->get($revision_table);
......
......@@ -5,7 +5,7 @@
* Install, update and uninstall functions for File module.
*/
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\Entity\Field;
/**
......@@ -271,10 +271,10 @@ function file_update_8003() {
if (in_array($field_config->get('type'), array('file', 'image'))) {
$field = new Field($field_config->get());
if (db_table_exists(DatabaseStorageController::_fieldTableName($field))) {
if (db_table_exists(FieldableDatabaseStorageController::_fieldTableName($field))) {
$tables = array(
DatabaseStorageController::_fieldTableName($field),
DatabaseStorageController::_fieldRevisionTableName($field),
FieldableDatabaseStorageController::_fieldTableName($field),
FieldableDatabaseStorageController::_fieldRevisionTableName($field),
);
foreach ($tables as $table_name) {
......
......@@ -7,7 +7,7 @@
* @ingroup views_module_handlers
*/
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\FieldInterface;
/**
......@@ -498,7 +498,7 @@ function file_field_views_data_views_data_alter(array &$data, FieldInterface $fi
'id' => 'entity_reverse',
'field_name' => $field_name,
'entity_type' => $entity_type,
'field table' => DatabaseStorageController::_fieldTableName($field),
'field table' => FieldableDatabaseStorageController::_fieldTableName($field),
'field field' => $field_name . '_target_id',
'base' => $entity_info['base_table'],
'base field' => $entity_info['entity_keys']['id'],
......
......@@ -7,12 +7,12 @@
namespace Drupal\file;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
/**
* File storage controller for files.
*/
class FileStorageController extends DatabaseStorageControllerNG implements FileStorageControllerInterface {
class FileStorageController extends FieldableDatabaseStorageController implements FileStorageControllerInterface {
/**
* {@inheritdoc}
......
......@@ -7,7 +7,7 @@
* @ingroup views_module_handlers
*/
use Drupal\Core\Entity\DatabaseStorageController;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\field\FieldInterface;
/**
......@@ -52,7 +52,7 @@ function image_field_views_data_views_data_alter(array &$data, FieldInterface $f
'id' => 'entity_reverse',
'field_name' => $field_name,
'entity_type' => $entity_type,
'field table' => DatabaseStorageController::_fieldTableName($field),
'field table' => FieldableDatabaseStorageController::_fieldTableName($field),
'field field' => $field_name . '_target_id',
'base' => $entity_info['base_table'],
'base field' => $entity_info['entity_keys']['id'],
......
......@@ -54,15 +54,13 @@ class MenuLinkStorageController extends DatabaseStorageController implements Men
* An array of entity info for the entity type.
* @param \Drupal\Core\Database\Connection $database
* The database connection to be used.
* @param \Drupal\field\FieldInfo $field_info
* The field info service.
* @param \Drupal\Component\Uuid\UuidInterface $uuid_service
* The UUID Service.
* @param \Symfony\Cmf\Component\Routing\RouteProviderInterface $route_provider
* The route provider service.
*/
public function __construct($entity_type, array $entity_info, Connection $database, FieldInfo $field_info, UuidInterface $uuid_service, RouteProviderInterface $route_provider) {
parent::__construct($entity_type, $entity_info, $database, $field_info, $uuid_service);
public function __construct($entity_type, array $entity_info, Connection $database, UuidInterface $uuid_service, RouteProviderInterface $route_provider) {
parent::__construct($entity_type, $entity_info, $database, $uuid_service);
$this->routeProvider = $route_provider;
......@@ -91,7 +89,6 @@ public static function createInstance(ContainerInterface $container, $entity_typ
$entity_type,
$entity_info,
$container->get('database'),
$container->get('field.info'),
$container->get('uuid'),
$container->get('router.route_provider')
);
......@@ -174,7 +171,6 @@ public function save(EntityInterface $entity) {
// Unlike the save() method from DatabaseStorageController, we invoke the
// 'presave' hook first because we want to allow modules to alter the
// entity before all the logic from our preSave() method.
$this->invokeFieldMethod('preSave', $entity);
$this->invokeHook('presave', $entity);
$entity->preSave($this);
......@@ -190,8 +186,6 @@ public function save(EntityInterface $entity) {
if (!$entity->isNew()) {
$this->resetCache(array($entity->{$this->idKey}));
$entity->postSave($this, TRUE);
$this->invokeFieldMethod('update', $entity);
$this->saveFieldItems($entity, TRUE);
$this->invokeHook('update', $entity);
}
else {
......@@ -200,8 +194,6 @@ public function save(EntityInterface $entity) {
$entity->enforceIsNew(FALSE);
$entity->postSave($this, FALSE);
$this->invokeFieldMethod('insert', $entity);
$this->saveFieldItems($entity, FALSE);
$this->invokeHook('insert', $entity);
}
}
......
......@@ -13,7 +13,7 @@
/**
* Defines a common interface for menu link entity controller classes.
*/
interface MenuLinkStorageControllerInterface extends EntityStorageControllerInterface {
interface MenuLinkStorageControllerInterface {
/**
* Sets an internal flag that allows us to prevent the reparenting operations
......
......@@ -7,7 +7,7 @@
namespace Drupal\node;
use Drupal\Core\Entity\DatabaseStorageControllerNG;
use Drupal\Core\Entity\FieldableDatabaseStorageController;
use Drupal\Core\Entity\EntityInterface;
/**
......@@ -16,7 +16,7 @@
* This extends the Drupal\Core\Entity\DatabaseStorageController class, adding
* required special handling for node entities.
*/
class NodeStorageController extends DatabaseStorageControllerNG {
class NodeStorageController extends FieldableDatabaseStorageController {
/**
* Overrides Drupal\Core\Entity\DatabaseStorageController::create().
......@@ -30,7 +30,7 @@ public function create(array $values) {
}