]> git.mxchange.org Git - friendica.git/commitdiff
Fix foreign key violation for Notify insert with uri_id/parent_uri_id 0 instead NULL
authorPhilipp <admin@philipp.info>
Thu, 21 Oct 2021 20:11:15 +0000 (22:11 +0200)
committerPhilipp <admin@philipp.info>
Thu, 21 Oct 2021 20:11:15 +0000 (22:11 +0200)
src/Navigation/Notifications/Depository/Notify.php
src/Navigation/Notifications/Entity/Notify.php

index 06de36c63832453900b5592772a59229e2675637..a380166c61ab95d9cf099b30d855c6cd893cb015 100644 (file)
@@ -485,9 +485,9 @@ class Notify extends BaseDepository
        private function storeAndSend($params, $sitelink, $tsitelink, $hsitelink, $title, $subject, $preamble, $epreamble, $body, $itemlink, $show_in_notification_page)
        {
                $item_id = $params['item']['id'] ?? 0;
-               $uri_id = $params['item']['uri-id'] ?? 0;
+               $uri_id = $params['item']['uri-id'] ?? null;
                $parent_id = $params['item']['parent'] ?? 0;
-               $parent_uri_id = $params['item']['parent-uri-id'] ?? 0;
+               $parent_uri_id = $params['item']['parent-uri-id'] ?? null;
 
                // Ensure that the important fields are set at any time
                $fields = ['nickname'];
index 88cd8ab36e865164a2930ff86d69250378ea6cf5..1a97835b6ed96d8a397e82e1bcb46d0b4fe40ba5 100644 (file)
@@ -60,14 +60,14 @@ class Notify extends BaseEntity
        protected $name_cache;
        /** @var string */
        protected $msg_cache;
-       /** @var int */
+       /** @var int|null */
        protected $uriId;
-       /** @var int */
+       /** @var int|null */
        protected $parentUriId;
        /** @var int */
        protected $id;
 
-       public function __construct(int $type, string $name, UriInterface $url, UriInterface $photo, DateTime $date, int $uid, UriInterface $link, bool $seen, string $verb, string $otype, string $name_cache, string $msg = null, string $msg_cache = null, int $itemId = null, int $uriId = null, int $parent = null, int $parentUriId = null, int $id = null)
+       public function __construct(int $type, string $name, UriInterface $url, UriInterface $photo, DateTime $date, int $uid, UriInterface $link, bool $seen, string $verb, string $otype, string $name_cache, string $msg = null, string $msg_cache = null, int $itemId = null, int $uriId = null, int $parent = null, ?int $parentUriId = null, ?int $id = null)
        {
                $this->type        = $type;
                $this->name        = $name;