/** * @param array $params * * @return string */ public function toHref($params = []) { return $this->notification->getPoster()->toHref($params); }
/** * Send new notification to receiver(parent) from poster(sender) * * @param string $type * @param PosterInterface $poster * @param PosterInterface $parent * @param ContentInterface|PosterInterface $about * @param $params * * @return Platform\Notification */ public function addNotification($type, PosterInterface $poster, PosterInterface $parent, $about = null, $params = []) { if (!$about) { $about = $poster; } $data = ['type_id' => $type, 'poster_id' => $poster->getId(), 'user_id' => $poster->getUserId(), 'parent_id' => $parent->getId(), 'parent_user_id' => $parent->getUserId(), 'poster_type' => $poster->getType(), 'parent_type' => $parent->getType(), 'about_type' => $about->getType(), 'about_id' => $about->getId(), 'params' => json_encode($params), 'created_at' => KENDO_DATE_TIME]; if (null != $about) { $data = array_merge($data, ['about_id' => $about->getId(), 'about_type' => $about->getType()]); } $item = new Notification($data); $item->save(); return $item; }