From 3546a01a34cc4ac95f273e681a3879d673250e3f Mon Sep 17 00:00:00 2001
From: Mac_Weber <Mac_Weber@789986.no-reply.drupal.org>
Date: Mon, 28 Dec 2015 19:07:24 -0200
Subject: [PATCH] Issue #2641626 by Mac_Weber: Replace deprecated usage of
 entity_create('view') with a direct call to View::create()

---
 core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php | 3 ++-
 core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php   | 3 ++-
 core/modules/views/src/Tests/Handler/HandlerAllTest.php           | 3 ++-
 core/modules/views_ui/src/Tests/TagTest.php                       | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
index 52b1ff7..3f4bbf4 100644
--- a/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
+++ b/core/modules/views/src/Plugin/views/relationship/GroupwiseMax.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Database\Query\AlterableInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\views\Views;
+use Drupal\Core\Entity\Entity\View;
 
 /**
  * Relationship handler that allows a groupwise maximum of the linked in table.
@@ -156,7 +157,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    * We use this to obtain our subquery SQL.
    */
   protected function getTemporaryView() {
-    $view = entity_create('view', array('base_table' => $this->definition['base']));
+    $view = View::create(array('base_table' => $this->definition['base']));
     $view->addDisplay('default');
     return $view->getExecutable();
   }
diff --git a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
index 95acc95..d6bd25c 100644
--- a/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
+++ b/core/modules/views/src/Plugin/views/wizard/WizardPluginBase.php
@@ -15,6 +15,7 @@
 use Drupal\views_ui\ViewUI;
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
 use Drupal\views\Plugin\views\PluginBase;
+use Drupal\Core\Entity\Entity\View;
 
 /**
  * @defgroup views_wizard_plugins Views wizard plugins
@@ -660,7 +661,7 @@ protected function instantiateView($form, FormStateInterface $form_state) {
       'langcode' => \Drupal::languageManager()->getDefaultLanguage()->getId(),
     );
 
-    $view = entity_create('view', $values);
+    $view = View::create($values);
 
     // Build all display options for this view.
     $display_options = $this->buildDisplayOptions($form, $form_state);
diff --git a/core/modules/views/src/Tests/Handler/HandlerAllTest.php b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
index 84579a8..c7eabbd 100644
--- a/core/modules/views/src/Tests/Handler/HandlerAllTest.php
+++ b/core/modules/views/src/Tests/Handler/HandlerAllTest.php
@@ -11,6 +11,7 @@
 use Drupal\views\ViewExecutable;
 use Drupal\views\Plugin\views\HandlerBase;
 use Drupal\views\Plugin\views\filter\InOperator;
+use Drupal\Core\Entity\Entity\View;
 
 /**
  * Tests instances of all handlers.
@@ -59,7 +60,7 @@ public function testHandlers() {
         continue;
       }
 
-      $view = entity_create('view', array('base_table' => $base_table));
+      $view = View::create(array('base_table' => $base_table));
       $view = $view->getExecutable();
 
       // @todo The groupwise relationship is currently broken.
diff --git a/core/modules/views_ui/src/Tests/TagTest.php b/core/modules/views_ui/src/Tests/TagTest.php
index b18ee98..13f32ae 100644
--- a/core/modules/views_ui/src/Tests/TagTest.php
+++ b/core/modules/views_ui/src/Tests/TagTest.php
@@ -10,6 +10,7 @@
 use Drupal\views\Tests\ViewKernelTestBase;
 use Drupal\views_ui\Controller\ViewsUIController;
 use Drupal\Component\Utility\Html;
+use Drupal\Core\Entity\Entity\View;
 
 /**
  * Tests the views ui tagging functionality.
@@ -37,7 +38,7 @@ public function testViewsUiAutocompleteTag() {
       $suffix = $i % 2 ? 'odd' : 'even';
       $tag = 'autocomplete_tag_test_' . $suffix . $this->randomMachineName();
       $tags[] = $tag;
-      entity_create('view', array('tag' => $tag, 'id' => $this->randomMachineName()))->save();
+      View::create(array('tag' => $tag, 'id' => $this->randomMachineName()))->save();
     }
 
     // Make sure just ten results are returns.
-- 
2.1.4

