diff core/modules/field/src/Entity/FieldConfig.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
line wrap: on
line diff
--- a/core/modules/field/src/Entity/FieldConfig.php	Thu Feb 28 13:11:55 2019 +0000
+++ b/core/modules/field/src/Entity/FieldConfig.php	Thu May 09 15:34:47 2019 +0100
@@ -162,7 +162,7 @@
 
     if ($this->isNew()) {
       // Notify the entity storage.
-      $entity_manager->onFieldDefinitionCreate($this);
+      \Drupal::service('field_definition.listener')->onFieldDefinitionCreate($this);
     }
     else {
       // Some updates are always disallowed.
@@ -176,7 +176,7 @@
         throw new FieldException("Cannot change an existing field's storage.");
       }
       // Notify the entity storage.
-      $entity_manager->onFieldDefinitionUpdate($this, $this->original);
+      \Drupal::service('field_definition.listener')->onFieldDefinitionUpdate($this, $this->original);
     }
 
     parent::preSave($storage);
@@ -223,12 +223,12 @@
    */
   public static function postDelete(EntityStorageInterface $storage, array $fields) {
     // Clear the cache upfront, to refresh the results of getBundles().
-    \Drupal::entityManager()->clearCachedFieldDefinitions();
+    \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
 
     // Notify the entity storage.
     foreach ($fields as $field) {
       if (!$field->deleted) {
-        \Drupal::entityManager()->onFieldDefinitionDelete($field);
+        \Drupal::service('field_definition.listener')->onFieldDefinitionDelete($field);
       }
     }
 
@@ -296,7 +296,7 @@
     if (!$this->fieldStorage) {
       $field_storage_definition = NULL;
 
-      $field_storage_definitions = $this->entityManager()->getFieldStorageDefinitions($this->entity_type);
+      $field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions($this->entity_type);
       if (isset($field_storage_definitions[$this->field_name])) {
         $field_storage_definition = $field_storage_definitions[$this->field_name];
       }