commit 867f0416bfc73c782b455f186dbe75e065a451af Author: fago Date: Thu Jun 5 12:58:46 2014 -0500 Rename methods. diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index ca9ecae..e6fe5fb 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -1131,7 +1131,7 @@ protected function doDeleteFieldItemsRevision(EntityInterface $entity) { /** * {@inheritdoc} */ - public function onFieldCreate(FieldStorageDefinitionInterface $storage_definition) { + public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) { $schema = $this->_fieldSqlSchema($storage_definition); foreach ($schema as $name => $table) { $this->database->schema()->createTable($name, $table); @@ -1141,7 +1141,7 @@ public function onFieldCreate(FieldStorageDefinitionInterface $storage_definitio /** * {@inheritdoc} */ - public function onFieldUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) { + public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) { if (!$storage_definition->hasData()) { // There is no data. Re-create the tables completely. @@ -1226,7 +1226,7 @@ public function onFieldUpdate(FieldStorageDefinitionInterface $storage_definitio /** * {@inheritdoc} */ - public function onFieldDelete(FieldStorageDefinitionInterface $storage_definition) { + public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) { // Mark all data associated with the field for deletion. $table = static::_fieldTableName($storage_definition); $revision_table = static::_fieldRevisionTableName($storage_definition); @@ -1245,7 +1245,7 @@ public function onFieldDelete(FieldStorageDefinitionInterface $storage_definitio /** * {@inheritdoc} */ - public function onInstanceDelete(FieldDefinitionInterface $field_definition) { + public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) { $table_name = static::_fieldTableName($field_definition); $revision_name = static::_fieldRevisionTableName($field_definition); $this->database->update($table_name) @@ -1261,7 +1261,7 @@ public function onInstanceDelete(FieldDefinitionInterface $field_definition) { /** * {@inheritdoc} */ - public function onInstanceUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) { + public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) { // Update the stored bundle, when the bundle changes. if ($field_definition->getBundle() != $original->getBundle()) { $is_deleted = $this->storageDefinitionIsDeleted($field_definition); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 76371ef..4d0caa0 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -268,32 +268,32 @@ protected function deleteFieldItemsRevision(EntityInterface $entity) { /** * {@inheritdoc} */ - public function onFieldCreate(FieldStorageDefinitionInterface $storage_definition) { } + public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition) { } /** * {@inheritdoc} */ - public function onFieldUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) { } + public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original) { } /** * {@inheritdoc} */ - public function onFieldDelete(FieldStorageDefinitionInterface $storage_definition) { } + public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition) { } /** * {@inheritdoc} */ - public function onInstanceCreate(FieldDefinitionInterface $field_definition) { } + public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition) { } /** * {@inheritdoc} */ - public function onInstanceUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) { } + public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original) { } /** * {@inheritdoc} */ - public function onInstanceDelete(FieldDefinitionInterface $field_definition) { } + public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition) { } /** * {@inheritdoc} diff --git a/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php b/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php index c48e1c2..85e0fb3 100644 --- a/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php +++ b/core/lib/Drupal/Core/Entity/FieldableEntityStorageInterface.php @@ -13,15 +13,15 @@ interface FieldableEntityStorageInterface extends EntityStorageInterface { /** - * Allows reaction to the creation of a field. + * Reacts to the creation of field storage definition. * * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition - * The field being created. + * The definition being created. */ - public function onFieldCreate(FieldStorageDefinitionInterface $storage_definition); + public function onFieldStorageDefinitionCreate(FieldStorageDefinitionInterface $storage_definition); /** - * Allows reaction to the update of a field. + * Reacts to the update of a field storage definition. * * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition * The field being updated. @@ -31,10 +31,10 @@ public function onFieldCreate(FieldStorageDefinitionInterface $storage_definitio * @throws \Drupal\Core\Entity\Exception\StorageDefinitionUpdateForbiddenException * Thrown when the update to the field is forbidden. */ - public function onFieldUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original); + public function onFieldStorageDefinitionUpdate(FieldStorageDefinitionInterface $storage_definition, FieldStorageDefinitionInterface $original); /** - * Allows reaction to the deletion of a field. + * Reacts to the deletion of a field storage definition. * * Stored values should not be wiped at once, but marked as 'deleted' so that * they can go through a proper purge process later on. @@ -42,43 +42,43 @@ public function onFieldUpdate(FieldStorageDefinitionInterface $storage_definitio * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition * The field being deleted. * - * @see fieldPurgeData() + * @see purgeFieldData() */ - public function onFieldDelete(FieldStorageDefinitionInterface $storage_definition); + public function onFieldStorageDefinitionDelete(FieldStorageDefinitionInterface $storage_definition); /** - * Allows reaction to the creation of a field. + * Reacts to the creation of a field. * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition - * The field being created. + * The field definition created. */ - public function onInstanceCreate(FieldDefinitionInterface $field_definition); + public function onFieldDefinitionCreate(FieldDefinitionInterface $field_definition); /** - * Allows reaction to the update of a field. + * Reacts to the update of a field. * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition - * The field being updated. + * The field definition being updated. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The original field definition; i.e., the definition before the update. */ - public function onInstanceUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original); + public function onFieldDefinitionUpdate(FieldDefinitionInterface $field_definition, FieldDefinitionInterface $original); /** - * Allows reaction to the deletion of a field. + * Reacts to the deletion of a field. * * Stored values should not be wiped at once, but marked as 'deleted' so that * they can go through a proper purge process later on. * * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition - * The field being deleted. + * The field definition being deleted. * - * @see fieldPurgeData() + * @see purgeFieldData() */ - public function onInstanceDelete(FieldDefinitionInterface $field_definition); + public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition); /** - * Allows reaction to a bundle being created. + * Reacts to a bundle being created. * * @param string $bundle * The name of the bundle created. @@ -86,7 +86,7 @@ public function onInstanceDelete(FieldDefinitionInterface $field_definition); public function onBundleCreate($bundle); /** - * Allows reaction to a bundle being renamed. + * Reacts to a bundle being renamed. * * This method runs before fields are updated with the new bundle name. * @@ -98,7 +98,7 @@ public function onBundleCreate($bundle); public function onBundleRename($bundle, $bundle_new); /** - * Allows reaction to a bundle being deleted. + * Reacts to a bundle being deleted. * * This method runs before fields are deleted. * diff --git a/core/modules/field/src/Entity/FieldConfig.php b/core/modules/field/src/Entity/FieldConfig.php index 66aa577..ddc60c8 100644 --- a/core/modules/field/src/Entity/FieldConfig.php +++ b/core/modules/field/src/Entity/FieldConfig.php @@ -322,7 +322,7 @@ protected function preSaveNew(EntityStorageInterface $storage) { $this->settings += $field_type_manager->getDefaultSettings($this->type); // Notify the entity storage. - $entity_manager->getStorage($this->entity_type)->onFieldCreate($this); + $entity_manager->getStorage($this->entity_type)->onFieldStorageDefinitionCreate($this); } /** @@ -368,7 +368,7 @@ protected function preSaveUpdated(EntityStorageInterface $storage) { // Notify the storage. The controller can reject the definition // update as invalid by raising an exception, which stops execution before // the definition is written to config. - $entity_manager->getStorage($this->entity_type)->onFieldUpdate($this, $this->original); + $entity_manager->getStorage($this->entity_type)->onFieldStorageDefinitionUpdate($this, $this->original); } /** @@ -437,7 +437,7 @@ public static function postDelete(EntityStorageInterface $storage, array $fields // Notify the storage. foreach ($fields as $field) { if (!$field->deleted) { - \Drupal::entityManager()->getStorage($field->entity_type)->onFieldDelete($field); + \Drupal::entityManager()->getStorage($field->entity_type)->onFieldStorageDefinitionDelete($field); $field->deleted = TRUE; } } diff --git a/core/modules/field/src/Entity/FieldInstanceConfig.php b/core/modules/field/src/Entity/FieldInstanceConfig.php index 6a5e319..728689c 100644 --- a/core/modules/field/src/Entity/FieldInstanceConfig.php +++ b/core/modules/field/src/Entity/FieldInstanceConfig.php @@ -334,7 +334,7 @@ public function preSave(EntityStorageInterface $storage) { // Set the default instance settings. $this->settings += $field_type_manager->getDefaultInstanceSettings($this->field->type); // Notify the entity storage. - $entity_manager->getStorage($this->entity_type)->onInstanceCreate($this); + $entity_manager->getStorage($this->entity_type)->onFieldDefinitionCreate($this); } else { // Some updates are always disallowed. @@ -350,7 +350,7 @@ public function preSave(EntityStorageInterface $storage) { // Set the default instance settings. $this->settings += $field_type_manager->getDefaultInstanceSettings($this->field->type); // Notify the entity storage. - $entity_manager->getStorage($this->entity_type)->onInstanceUpdate($this, $this->original); + $entity_manager->getStorage($this->entity_type)->onFieldDefinitionUpdate($this, $this->original); } if (!$this->isSyncing()) { // Ensure the correct dependencies are present. @@ -421,7 +421,7 @@ public static function postDelete(EntityStorageInterface $storage, array $instan // Notify the entity storage. foreach ($instances as $instance) { if (!$instance->deleted) { - \Drupal::entityManager()->getStorage($instance->entity_type)->onInstanceDelete($instance); + \Drupal::entityManager()->getStorage($instance->entity_type)->onFieldDefinitionDelete($instance); } }