Commit 5aa4522c authored by catch's avatar catch

Issue #2503403 by naveenvalecha, DuaelFr, Mac_Weber: Replace deprecated usage...

Issue #2503403 by naveenvalecha, DuaelFr, Mac_Weber: Replace deprecated usage of entity_create('aggregator_*') with a direct call to Feed/Item::create()
parent a79891da
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace Drupal\aggregator\Plugin\aggregator\processor; namespace Drupal\aggregator\Plugin\aggregator\processor;
use Drupal\aggregator\Entity\Item;
use Drupal\aggregator\ItemStorageInterface; use Drupal\aggregator\ItemStorageInterface;
use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase; use Drupal\aggregator\Plugin\AggregatorPluginSettingsBase;
use Drupal\aggregator\Plugin\ProcessorInterface; use Drupal\aggregator\Plugin\ProcessorInterface;
...@@ -215,7 +216,7 @@ public function process(FeedInterface $feed) { ...@@ -215,7 +216,7 @@ public function process(FeedInterface $feed) {
$entry = reset($entry); $entry = reset($entry);
} }
else { else {
$entry = entity_create('aggregator_item', array('langcode' => $feed->language()->getId())); $entry = Item::create(array('langcode' => $feed->language()->getId()));
} }
if ($item['timestamp']) { if ($item['timestamp']) {
$entry->setPostedTime($item['timestamp']); $entry->setPostedTime($item['timestamp']);
......
...@@ -137,7 +137,7 @@ public function getFeedEditObject($feed_url = NULL, array $values = array()) { ...@@ -137,7 +137,7 @@ public function getFeedEditObject($feed_url = NULL, array $values = array()) {
'url' => $feed_url, 'url' => $feed_url,
'refresh' => '900', 'refresh' => '900',
); );
return entity_create('aggregator_feed', $values); return Feed::create($values);
} }
/** /**
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
namespace Drupal\aggregator\Tests; namespace Drupal\aggregator\Tests;
use Drupal\Core\Url; use Drupal\Core\Url;
use Drupal\aggregator\Entity\Feed;
/** /**
* Tests the built-in feed parser with valid feed samples. * Tests the built-in feed parser with valid feed samples.
...@@ -89,7 +90,7 @@ public function testHtmlEntitiesSample() { ...@@ -89,7 +90,7 @@ public function testHtmlEntitiesSample() {
*/ */
public function testRedirectFeed() { public function testRedirectFeed() {
$redirect_url = Url::fromRoute('aggregator_test.redirect')->setAbsolute()->toString(); $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->save();
$feed->refreshItems(); $feed->refreshItems();
...@@ -103,7 +104,7 @@ public function testRedirectFeed() { ...@@ -103,7 +104,7 @@ public function testRedirectFeed() {
public function testInvalidFeed() { public function testInvalidFeed() {
// Simulate a typo in the URL to force a curl exception. // Simulate a typo in the URL to force a curl exception.
$invalid_url = 'http:/www.drupal.org'; $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(); $feed->save();
// Update the feed. Use the UI to be able to check the message easily. // Update the feed. Use the UI to be able to check the message easily.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment