interdiff impossible; taking evasive action reverted: --- b/core/modules/taxonomy/src/Entity/Vocabulary.php +++ a/core/modules/taxonomy/src/Entity/Vocabulary.php @@ -52,21 +52,21 @@ * * @var string */ + public $vid; - protected $vid; /** * Name of the vocabulary. * * @var string */ + public $name; - protected $name; /** * Description of the vocabulary. * * @var string */ + public $description; - protected $description; /** * The type of hierarchy allowed within the vocabulary. @@ -78,14 +78,58 @@ * * @var integer */ + public $hierarchy = TAXONOMY_HIERARCHY_DISABLED; - protected $hierarchy = TAXONOMY_HIERARCHY_DISABLED; /** * The weight of this vocabulary in relation to other vocabularies. * * @var integer */ + public $weight = 0; + + /** + * {@inheritdoc} + */ + public function id() { + return $this->vid; + } + + /** + * {@inheritdoc} + */ + public function postSave(EntityStorageInterface $storage, $update = TRUE) { + parent::postSave($storage, $update); + + if ($update && $this->getOriginalId() != $this->id() && !$this->isSyncing()) { + // Reflect machine name changes in the definitions of existing 'taxonomy' + // fields. + $field_ids = array(); + $field_map = \Drupal::entityManager()->getFieldMapByFieldType('taxonomy_term_reference'); + foreach ($field_map as $entity_type => $field_storages) { + foreach ($field_storages as $field_storage => $info) { + $field_ids[] = $entity_type . '.' . $field_storage; + } + } + + $field_storages = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple($field_ids); + + foreach ($field_storages as $field_storage) { + $update_storage = FALSE; + + foreach ($field_storage->settings['allowed_values'] as &$value) { + if ($value['vocabulary'] == $this->getOriginalId()) { + $value['vocabulary'] = $this->id(); + $update_storage = TRUE; + } + } + + if ($update_storage) { + $field_storage->save(); + } + } + } + $storage->resetCache($update ? array($this->getOriginalId()) : array()); + } - protected $weight = 0; /** * {@inheritdoc} @@ -139,85 +183,4 @@ } } - /** - * {@inheritdoc} - */ - public function getDescription() { - return $this->get('description'); - } - - /** - * {@inheritdoc} - */ - public function getHierarchy() { - return $this->get('hierarchy'); - } - - /** - * {@inheritdoc} - */ - public function setHierarchy($hierarchy) { - $this->set('hierarchy', $hierarchy); - return $this; - } - - /** - * {@inheritdoc} - */ - public function getName() { - return $this->get('name'); - } - - /** - * {@inheritdoc} - */ - public function setName($name) { - $this->set('name', $name); - return $this; - } - - /** - * {@inheritdoc} - */ - public function postSave(EntityStorageInterface $storage, $update = TRUE) { - parent::postSave($storage, $update); - - if ($update && $this->getOriginalId() != $this->id() && !$this->isSyncing()) { - // Reflect machine name changes in the definitions of existing 'taxonomy' - // fields. - $field_ids = array(); - $field_map = \Drupal::entityManager()->getFieldMapByFieldType('taxonomy_term_reference'); - foreach ($field_map as $entity_type => $fields) { - foreach ($fields as $field => $info) { - $field_ids[] = $entity_type . '.' . $field; - } - } - - $field_storages = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple($field_ids); - - foreach ($field_storages as $field_storage) { - $update_field = FALSE; - - foreach ($field_storage->settings['allowed_values'] as &$value) { - if ($value['vocabulary'] == $this->getOriginalId()) { - $value['vocabulary'] = $this->id(); - $update_field = TRUE; - } - } - - if ($update_field) { - $field_storage->save(); - } - } - } - $storage->resetCache($update ? array($this->getOriginalId()) : array()); - } - - /** - * {@inheritdoc} - */ - public function id() { - return $this->vid; - } - } unchanged: --- a/core/modules/taxonomy/src/Entity/Vocabulary.php +++ b/core/modules/taxonomy/src/Entity/Vocabulary.php @@ -52,21 +52,21 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface { * * @var string */ - public $vid; + protected $vid; /** * Name of the vocabulary. * * @var string */ - public $name; + protected $name; /** * Description of the vocabulary. * * @var string */ - public $description; + protected $description; /** * The type of hierarchy allowed within the vocabulary. @@ -78,14 +78,51 @@ class Vocabulary extends ConfigEntityBundleBase implements VocabularyInterface { * * @var integer */ - public $hierarchy = TAXONOMY_HIERARCHY_DISABLED; + protected $hierarchy = TAXONOMY_HIERARCHY_DISABLED; /** * The weight of this vocabulary in relation to other vocabularies. * * @var integer */ - public $weight = 0; + protected $weight = 0; + + /** + * {@inheritdoc} + */ + public function getDescription() { + return $this->get('description'); + } + + /** + * {@inheritdoc} + */ + public function getHierarchy() { + return $this->get('hierarchy'); + } + + /** + * {@inheritdoc} + */ + public function setHierarchy($hierarchy) { + $this->set('hierarchy', $hierarchy); + return $this; + } + + /** + * {@inheritdoc} + */ + public function getName() { + return $this->get('name'); + } + + /** + * {@inheritdoc} + */ + public function setName($name) { + $this->set('name', $name); + return $this; + } /** * {@inheritdoc}