summaryrefslogtreecommitdiffstats
path: root/lib/Command/Updater/UpdateFeed.php
diff options
context:
space:
mode:
authorSean Molenaar <sean@seanmolenaar.eu>2020-08-29 23:39:35 +0200
committerBenjamin Brahmer <info@b-brahmer.de>2020-09-27 15:35:31 +0200
commitd00d1ab2a28f428223e52b17052c072c64784016 (patch)
treec019f85fb7ac67147dd43ca64b4ac3cda99832f7 /lib/Command/Updater/UpdateFeed.php
parent5687baca75d47dbdffd3de74e865ad2f71ef0cb7 (diff)
Create V2 mapper, Service and management commands
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Command/Updater/UpdateFeed.php')
-rw-r--r--lib/Command/Updater/UpdateFeed.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Command/Updater/UpdateFeed.php b/lib/Command/Updater/UpdateFeed.php
index f5cda22ad..5078e92a4 100644
--- a/lib/Command/Updater/UpdateFeed.php
+++ b/lib/Command/Updater/UpdateFeed.php
@@ -13,6 +13,7 @@ namespace OCA\News\Command\Updater;
use Exception;
+use OCA\News\Service\FeedServiceV2;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@@ -22,9 +23,12 @@ use OCA\News\Service\FeedService;
class UpdateFeed extends Command
{
+ /**
+ * @var FeedServiceV2 Feed service
+ */
private $feedService;
- public function __construct(FeedService $feedService)
+ public function __construct(FeedServiceV2 $feedService)
{
parent::__construct();
$this->feedService = $feedService;
@@ -34,24 +38,25 @@ class UpdateFeed extends Command
{
$this->setName('news:updater:update-feed')
->addArgument(
- 'feed-id',
+ 'user-id',
InputArgument::REQUIRED,
- 'feed id, integer'
+ 'user id of a user, string'
)
->addArgument(
- 'user-id',
+ 'feed-id',
InputArgument::REQUIRED,
- 'user id of a user, string'
+ 'feed id, integer'
)
->setDescription('Console API for updating a single user\'s feed');
}
- protected function execute(InputInterface $input, OutputInterface $output)
+ protected function execute(InputInterface $input, OutputInterface $output): int
{
$feedId = $input->getArgument('feed-id');
$userId = $input->getArgument('user-id');
try {
- $this->feedService->update($feedId, $userId);
+ $feed = $this->feedService->findForUser($userId, $feedId);
+ $this->feedService->fetch($feed);
} catch (Exception $e) {
$output->writeln(
'<error>Could not update feed with id ' . $feedId .
@@ -59,5 +64,7 @@ class UpdateFeed extends Command
'</error> '
);
}
+
+ return 0;
}
}