diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php index 040297f..0f35e31 100644 --- a/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php +++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumTest.php @@ -240,7 +240,10 @@ function testForum() { function testAddOrphanTopic() { // Must remove forum topics to test creating orphan topics. $vid = config('forum.settings')->get('vocabulary'); - taxonomy_term_delete_multiple(array_keys(entity_load_multiple_by_properties('taxonomy_term', array('vid' => $vid)))); + $tids = \Drupal::entityQuery('taxonomy_term') + ->condition('vid', $vid) + ->execute(); + taxonomy_term_delete_multiple($tids); // Create an orphan forum item. $this->drupalLogin($this->admin_user); diff --git a/core/modules/path/path.module b/core/modules/path/path.module index 771acc1..dcb22fb 100644 --- a/core/modules/path/path.module +++ b/core/modules/path/path.module @@ -235,7 +235,7 @@ function path_form_taxonomy_term_form_alter(&$form, $form_state) { // Make sure this does not show up on the delete confirmation form. if (empty($form_state['confirm_delete'])) { $term = $form_state['controller']->getEntity($form_state); - $path = ($term->id() ? drupal_container()->get('path.crud')->load(array('source' => 'taxonomy/term/' . $term->id())) : array()); + $path = ($term->id() ? Drupal::service('path.crud')->load(array('source' => 'taxonomy/term/' . $term->id())) : array()); if ($path === FALSE) { $path = array(); } @@ -303,7 +303,7 @@ function path_taxonomy_term_insert(Term $term) { // Ensure fields for programmatic executions. $source = 'taxonomy/term/' . $term->id(); $langcode = LANGUAGE_NOT_SPECIFIED; - drupal_container()->get('path.crud')->save($source, $term->path->alias, $langcode); + Drupal::service('path.crud')->save($source, $term->path->alias, $langcode); } } } @@ -316,7 +316,7 @@ function path_taxonomy_term_update(Term $term) { $term->path->alias = trim($term->path->alias); // Delete old alias if user erased it. if (!empty($term->path->pid) && empty($term->path->alias)) { - drupal_container()->get('path.crud')->delete(array('pid' => $term->path->pid)); + Drupal::service('path.crud')->delete(array('pid' => $term->path->pid)); } // Only save a non-empty alias. if ($term->path->alias) { @@ -324,7 +324,7 @@ function path_taxonomy_term_update(Term $term) { // Ensure fields for programmatic executions. $source = 'taxonomy/term/' . $term->id(); $langcode = LANGUAGE_NOT_SPECIFIED; - drupal_container()->get('path.crud')->save($source, $term->path->alias, $langcode, $pid); + Drupal::service('path.crud')->save($source, $term->path->alias, $langcode, $pid); } } } @@ -334,7 +334,7 @@ function path_taxonomy_term_update(Term $term) { */ function path_taxonomy_term_delete(Term $term) { // Delete all aliases associated with this term. - drupal_container()->get('path.crud')->delete(array('source' => 'taxonomy/term/' . $term->id())); + Drupal::service('path.crud')->delete(array('source' => 'taxonomy/term/' . $term->id())); } /** diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php index 9e22457..c1398c5 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/Core/Entity/Term.php @@ -49,42 +49,42 @@ class Term extends EntityNG implements ContentEntityInterface { /** * The taxonomy term ID. * - * @var integer + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $tid; /** * The term UUID. * - * @var string + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $uuid; /** * The taxonomy vocabulary ID this term belongs to. * - * @var integer + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $vid; /** * Name of the term. * - * @var string + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $name; /** * Description of the term. * - * @var string + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $description; /** * The text format name for the term's description. * - * @var string + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $format; @@ -94,7 +94,7 @@ class Term extends EntityNG implements ContentEntityInterface { * This property stores the weight of this term in relation to other terms of * the same vocabulary. * - * @var integer + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $weight; @@ -108,10 +108,15 @@ class Term extends EntityNG implements ContentEntityInterface { * term does not have any parents. When omitting this variable during an * update, the existing hierarchy for the term remains unchanged. * - * @var array + * @var \Drupal\Core\Entity\Field\FieldInterface */ public $parent; + /** + * Default values for the term. + * + * @var array + */ protected $values = array( 'langcode' => array(LANGUAGE_DEFAULT => array(0 => array('value' => LANGUAGE_NOT_SPECIFIED))), 'weight' => array(LANGUAGE_DEFAULT => array(0 => array('value' => 0))), diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php index 8553bb0..ad4d6a1 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/TermStorageController.php @@ -82,7 +82,7 @@ protected function postSave(EntityInterface $entity, $update) { // value. $parents = $entity->parent->getValue(); $parent = reset($parents); - if (isset($parent['value']) && $parent['value'] !== NULL) { + if (isset($parent['value'])) { db_delete('taxonomy_term_hierarchy') ->condition('tid', $entity->id()) ->execute(); @@ -93,7 +93,7 @@ protected function postSave(EntityInterface $entity, $update) { foreach ($entity->parent as $parent) { $query->values(array( 'tid' => $entity->id(), - 'parent' => (int)$parent->value, + 'parent' => (int) $parent->value, )); } $query->execute(); diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/HooksTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/HooksTest.php index 39cd8b1..88d7871a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/HooksTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/HooksTest.php @@ -74,7 +74,7 @@ function testTaxonomyTermHooks() { $this->assertFalse(empty($term_build['taxonomy_terms'][$term->id()]['taxonomy_test_entity_view_check']), 'hook_entity_view() was invoked when viewing the term.'); // Delete the term. - taxonomy_term_delete($term->id()); + $term->delete(); $antonym = db_query('SELECT tid FROM {taxonomy_term_antonym} WHERE tid = :tid', array(':tid' => $term->id()))->fetchField(); $this->assertFalse($antonym, 'The antonym were deleted from the database.'); } diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php index a2d74e2..501c26c 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/LoadMultipleTest.php @@ -52,7 +52,7 @@ function testTaxonomyTermMultipleLoad() { // Remove one term from the array, then delete it. $deleted = array_shift($terms2); - taxonomy_term_delete($deleted->id()); + $deleted->delete(); $deleted_term = taxonomy_term_load($deleted->id()); $this->assertFalse($deleted_term);