From 5aa4522c0d2ca984cf1c38584998133937a69c89 Mon Sep 17 00:00:00 2001
From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org>
Date: Mon, 15 Feb 2016 08:43:58 +0900
Subject: [PATCH] Issue #2503403 by naveenvalecha, DuaelFr, Mac_Weber: Replace
 deprecated usage of entity_create('aggregator_*') with a direct call to
 Feed/Item::create()

---
 .../src/Plugin/aggregator/processor/DefaultProcessor.php     | 3 ++-
 core/modules/aggregator/src/Tests/AggregatorTestBase.php     | 2 +-
 core/modules/aggregator/src/Tests/FeedParserTest.php         | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
index 95c6324b95c6..7a4a698c18e2 100644
--- a/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
+++ b/core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\aggregator\Plugin\aggregator\processor;
 
+use Drupal\aggregator\Entity\Item;
 use Drupal\aggregator\ItemStorageInterface;
 use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
 use Drupal\aggregator\Plugin\ProcessorInterface;
@@ -215,7 +216,7 @@ public function process(FeedInterface $feed) {
         $entry = reset($entry);
       }
       else {
-        $entry = entity_create('aggregator_item', array('langcode' => $feed->language()->getId()));
+        $entry = Item::create(array('langcode' => $feed->language()->getId()));
       }
       if ($item['timestamp']) {
         $entry->setPostedTime($item['timestamp']);
diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
index d5b09e5256a5..13f0a77f979a 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
@@ -137,7 +137,7 @@ public function getFeedEditObject($feed_url = NULL, array $values = array()) {
       'url' => $feed_url,
       'refresh' => '900',
     );
-    return entity_create('aggregator_feed', $values);
+    return Feed::create($values);
   }
 
   /**
diff --git a/core/modules/aggregator/src/Tests/FeedParserTest.php b/core/modules/aggregator/src/Tests/FeedParserTest.php
index f507302a34c6..888308916889 100644
--- a/core/modules/aggregator/src/Tests/FeedParserTest.php
+++ b/core/modules/aggregator/src/Tests/FeedParserTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\aggregator\Tests;
 
 use Drupal\Core\Url;
+use Drupal\aggregator\Entity\Feed;
 
 /**
  * Tests the built-in feed parser with valid feed samples.
@@ -89,7 +90,7 @@ public function testHtmlEntitiesSample() {
    */
   public function testRedirectFeed() {
     $redirect_url = Url::fromRoute('aggregator_test.redirect')->setAbsolute()->toString();
-    $feed = entity_create('aggregator_feed', array('url' => $redirect_url, 'title' => $this->randomMachineName()));
+    $feed = Feed::create(array('url' => $redirect_url, 'title' => $this->randomMachineName()));
     $feed->save();
     $feed->refreshItems();
 
@@ -103,7 +104,7 @@ public function testRedirectFeed() {
   public function testInvalidFeed() {
     // Simulate a typo in the URL to force a curl exception.
     $invalid_url = 'http:/www.drupal.org';
-    $feed = entity_create('aggregator_feed', array('url' => $invalid_url, 'title' => $this->randomMachineName()));
+    $feed = Feed::create(array('url' => $invalid_url, 'title' => $this->randomMachineName()));
     $feed->save();
 
     // Update the feed. Use the UI to be able to check the message easily.
-- 
GitLab