Verified Commit 142b16f4 authored by Anmol Goel's avatar Anmol Goel Committed by Anmol Goel
Browse files

Issue #3070795 by ravi.shankar, anmolgoyal74: Remove deprecated method...

Issue #3070795 by ravi.shankar, anmolgoyal74: Remove deprecated method entityManager()  in src/Commands/CleantaxonomyCommands.php
parent 893659a7
Loading
Loading
Loading
Loading
+1 −1
Changes for cleantaxonomy.drush.inc: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ function drush_cleantaxonomy_replace_callback($arg1, $arg2) {
  $term_from = $data->fetchAll(\PDO::FETCH_ASSOC);
  $term_from = $term_from[0]['tid'];

  $term2_obj = \Drupal::entityManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $name2]);
  $term2_obj = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $name2]);

  if (empty($term_from) || empty($term2_obj)) {
    drush_set_error("Terms not found! Please enter correct terms.");
+2 −2
Changes for src/Commands/CleantaxonomyCommands.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ class CleantaxonomyCommands extends DrushCommands {
    $term_from = $data->fetchAll(\PDO::FETCH_ASSOC);
    $term_from = $term_from[0]['tid'];

    $term2_obj = \Drupal::entityManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $name2]);
    $term2_obj = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['name' => $name2]);

    if (empty($term_from) || empty($term2_obj)) {
      throw new \Exception("Terms not found! Please enter correct terms.");
@@ -63,7 +63,7 @@ class CleantaxonomyCommands extends DrushCommands {

      $entityManager = \Drupal::service('entity_field.manager');
      foreach ($nodes_with_term_from as $value) {
        $node_storage = \Drupal::entityManager()->getStorage('node');
        $node_storage = \Drupal::entityTypeManager()->getStorage('node');
        $node = $node_storage->load($value['nid']);
        $bundle = $node->bundle();
        $fields = $entityManager->getFieldDefinitions('node', $bundle);