setProperties([ 'type' => $type ]); return $ticketEvent; } public function getProps() { return [ 'type', 'content', 'file', 'authorUser', 'authorStaff', 'date' ]; } public function getAuthor() { if($this->authorUser) { return $this->authorUser; } if($this->authorStaff) { return $this->authorStaff; } return new NullDataStore(); } public function toArray() { $user = ($this->authorUser instanceof User) ? $this->authorUser : $this->authorStaff; return [ 'type' => $this->type, 'ticketNumber' => $this->ticket->ticketNumber, 'author' => [ 'name' => $user->name, 'id' => $user->id ] ]; } }