summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-14 23:43:58 (GMT)
committerNathaniel Catchpole2016-02-14 23:43:58 (GMT)
commit5aa4522c0d2ca984cf1c38584998133937a69c89 (patch)
tree44076346e9cbef17bb8397c4f1df42872935fda6
parenta79891dadf3eb1a43f25d7bae5fe5ddc2910934f (diff)
Issue #2503403 by naveenvalecha, DuaelFr, Mac_Weber: Replace deprecated usage of entity_create('aggregator_*') with a direct call to Feed/Item::create()
-rw-r--r--core/modules/aggregator/src/Plugin/aggregator/processor/DefaultProcessor.php3
-rw-r--r--core/modules/aggregator/src/Tests/AggregatorTestBase.php2
-rw-r--r--core/modules/aggregator/src/Tests/FeedParserTest.php5
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 95c6324..7a4a698 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 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor
$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 d5b09e5..13f0a77 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
@@ -137,7 +137,7 @@ abstract class AggregatorTestBase extends WebTestBase {
'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 f507302..8883089 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 @@ class FeedParserTest extends AggregatorTestBase {
*/
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 @@ class FeedParserTest extends AggregatorTestBase {
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.