diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php index 1ff529f..69bf8c3 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageController.php @@ -8,7 +8,7 @@ namespace Drupal\aggregator; use Drupal\Core\Entity\DatabaseStorageControllerNG; -use Drupal\Core\Entity\EntityInterface; +use Drupal\aggregator\Entity\FeedInterface; /** * Controller class for aggregator's feeds. @@ -38,7 +38,7 @@ public function loadCategories(array $feeds) { /** * {@inheritdoc} */ - public function saveCategories(EntityInterface $feed, array $categories) { + public function saveCategories(FeedInterface $feed, array $categories) { foreach ($categories as $cid => $value) { if ($value) { $this->database->insert('aggregator_category_feed') @@ -72,7 +72,7 @@ public function getFeedDuplicates(EntityInterface $feed) { $query = $this->database->query("SELECT title, url FROM {aggregator_feed} WHERE title = :title OR url = :url", array(':title' => $feed->label(), ':url' => $feed->url->value)); } - return $query; + return $query->fetchAll(); } } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php index cd8162c..9ca3e24 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/FeedStorageControllerInterface.php @@ -7,7 +7,7 @@ namespace Drupal\aggregator; -use Drupal\Core\Entity\EntityInterface; +use Drupal\aggregator\Entity\FeedInterface; use Drupal\Core\Entity\EntityStorageControllerInterface; /** @@ -27,12 +27,12 @@ public function loadCategories(array $feeds); /** * Saves the categories of a feed. * - * @param \Drupal\Core\Entity\EntityInterface $feed + * @param \Drupal\aggregator\Entity\FeedInterface $feed * The feed entity. * @param array $categories * The array of categories. */ - public function saveCategories(EntityInterface $feed, array $categories); + public function saveCategories(FeedInterface $feed, array $categories); /** * Deletes the categories of a feed. @@ -47,6 +47,9 @@ public function deleteCategories(array $feeds); * * @param \Drupal\Core\Entity\EntityInterface $feed * The feed entity. + * + * @return + * An array with the list of duplicated feeds. */ - public function getFeedDuplicates(EntityInterface $feed); + public function getFeedDuplicates(FeedInterface $feed); } diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php index 8eee427..a157946 100644 --- a/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php +++ b/core/modules/aggregator/lib/Drupal/aggregator/Form/OpmlFeedAdd.php @@ -10,7 +10,6 @@ use Drupal\aggregator\CategoryStorageControllerInterface; use Drupal\aggregator\FeedStorageControllerInterface; use Drupal\Component\Utility\Url; -use Drupal\Core\Database\Connection; use Drupal\Core\Entity\Query\QueryFactory; use Drupal\Core\Form\FormBase; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -24,13 +23,6 @@ class OpmlFeedAdd extends FormBase { /** - * The database connection object. - * - * @var \Drupal\Core\Database\Connection - */ - protected $database; - - /** * The entity query factory object. * * @var \Drupal\Core\Entity\Query\QueryFactory @@ -61,8 +53,6 @@ class OpmlFeedAdd extends FormBase { /** * Constructs a database object. * - * @param \Drupal\Core\Database\Connection $database - * The database object. * @param \Drupal\Core\Entity\Query\QueryFactory $query_factory * The entity query object. * @param \Drupal\aggregator\FeedStorageControllerInterface $feed_storage @@ -72,8 +62,7 @@ class OpmlFeedAdd extends FormBase { * @param \Drupal\aggregator\CategoryStorageControllerInterface $category_storage_controller * The category storage controller. */ - public function __construct(Connection $database, QueryFactory $query_factory, FeedStorageControllerInterface $feed_storage, ClientInterface $http_client, CategoryStorageControllerInterface $category_storage_controller) { - $this->database = $database; + public function __construct(QueryFactory $query_factory, FeedStorageControllerInterface $feed_storage, ClientInterface $http_client, CategoryStorageControllerInterface $category_storage_controller) { $this->queryFactory = $query_factory; $this->feedStorage = $feed_storage; $this->httpClient = $http_client; @@ -85,7 +74,6 @@ public function __construct(Connection $database, QueryFactory $query_factory, F */ public static function create(ContainerInterface $container) { return new static( - $container->get('database'), $container->get('entity.query'), $container->get('entity.manager')->getStorageController('aggregator_feed'), $container->get('http_default_client'),