diff options
author | Sean Molenaar <sean@seanmolenaar.eu> | 2020-10-04 20:45:33 +0200 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2020-11-03 19:58:37 +0100 |
commit | 10e8c28feaf6d858948285a291231f651ef74728 (patch) | |
tree | 5c48216dc1ce6a6dd8f292d489bb4a7d03cb5595 /lib/Service/FeedService.php | |
parent | 361cfa55b7302b29e158647060085550b9a3dfe1 (diff) |
Add migration with foreign keys
Closes #829
Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
Diffstat (limited to 'lib/Service/FeedService.php')
-rw-r--r-- | lib/Service/FeedService.php | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/Service/FeedService.php b/lib/Service/FeedService.php index ab9c18219..c671a035c 100644 --- a/lib/Service/FeedService.php +++ b/lib/Service/FeedService.php @@ -103,21 +103,27 @@ class FeedService extends Service /** * Creates a new feed * - * @param string $feedUrl the url to the feed - * @param int $folderId the folder where it should be put into, 0 for root + * @param string $feedUrl the url to the feed + * @param int|null $folderId the folder where it should be put into, null for root * folder - * @param string $userId for which user the feed should be created - * @param string $title if given, this is used for the opml feed title - * @param string $user if given, basic auth is set for this feed - * @param string $password if given, basic auth is set for this + * @param string $userId for which user the feed should be created + * @param string|null $title if given, this is used for the opml feed title + * @param string|null $user if given, basic auth is set for this feed + * @param string|null $password if given, basic auth is set for this * feed. Ignored if user is null or an empty string * + * @return Feed the newly created feed * @throws ServiceConflictException if the feed exists already * @throws ServiceNotFoundException if the url points to an invalid feed - * @return Feed the newly created feed */ - public function create($feedUrl, $folderId, $userId, $title = null, $user = null, $password = null) - { + public function create( + string $feedUrl, + ?int $folderId, + string $userId, + string $title = null, + string $user = null, + string $password = null + ) { // first try if the feed exists already try { /** @@ -369,7 +375,7 @@ class FeedService extends Service $feed->setUrl($url); $feed->setTitle($this->l10n->t('Articles without feed')); $feed->setAdded($this->timeFactory->getTime()); - $feed->setFolderId(0); + $feed->setFolderId(null); $feed->setPreventUpdate(true); /** @var Feed $feed */ $feed = $this->feedMapper->insert($feed); |