setProperties([ 'type' => $type ]); return $ticketEvent; } public static function getProps() { return [ 'type', 'content', 'file', 'authorUser', 'authorStaff', 'date', 'private', 'editedContent' ]; } public function getAuthor() { if($this->authorUser) { return $this->authorUser; } if($this->authorStaff) { return $this->authorStaff; } return new NullDataStore(); } public static function getTicketEvent($value, $property = 'id') { return parent::getDataStore($value, $property); } public function toArray() { $user = ($this->authorStaff) ? $this->authorStaff : $this->authorUser; return [ 'type' => $this->type, 'ticketNumber' => $this->ticket->ticketNumber, 'author' => [ 'name' => $user ? $user->name : null, 'staff' => $user instanceOf Staff, 'id' => $user ? $user->id : null, 'customfields' => $user->xownCustomfieldvalueList ? $user->xownCustomfieldvalueList->toArray() : [], ], 'edited' => $this->editedContent ]; } }