'channel:json_string', 'Message' => 'message:json_string', 'SentDate' => 'sent_date:datetime_epoch', 'Created' => 'created:datetime_epoch', 'IsSent' => 'is_sent:json_boolean', ); /** * @param null $expand * @param array $fields * @param array $relations * @param array $params * @return array */ public function serialize($expand = null, array $fields = array(), array $relations = array(), array $params = array() ) { $notification = $this->object; if(! $notification instanceof SummitPushNotification) return []; $values = parent::serialize($expand, $fields, $relations, $params); if($notification->getChannel() == SummitPushNotificationChannel::Event){ $values['event'] = SerializerRegistry::getInstance()->getSerializer($notification->getSummitEvent())->serialize(); } if($notification->getChannel() == SummitPushNotificationChannel::Group){ $values['group'] = SerializerRegistry::getInstance()->getSerializer($notification->getGroup())->serialize(); } return $values; } }