/** * Sets the creator of this comment. * * @param kyUser|kyStaff|string $creator Creator (staff object, user object or user fullname) of this comment. * @return $this */ public function setCreator($creator) { if ($creator instanceof kyStaff) { $this->creator_staff = $creator; $this->creator_id = $this->creator_staff->getId(); $this->creator_type = self::CREATOR_TYPE_STAFF; $this->creator_user = null; } elseif ($creator instanceof kyUser) { $this->creator_user = $creator; $this->creator_id = $this->creator_user->getId(); $this->creator_type = self::CREATOR_TYPE_USER; $this->creator_staff = null; } elseif (is_string($creator) && strlen($creator) > 0) { $this->setCreatorFullname($creator); } else { $this->creator_id = null; $this->creator_type = null; $this->creator_staff = null; $this->creator_user = null; } return $this; }
/** * Sets user, the creator of this post. * * @param kyUser $user User. * @return kyTicketPost */ public function setUser($user) { $this->user = ky_assure_object($user, 'kyUser'); $this->user_id = $this->user !== null ? $this->user->getId() : null; $this->creator = $this->user !== null ? self::CREATOR_USER : null; if ($this->user !== null) { $this->full_name = $this->user->getFullName(); $this->email = $this->user->getEmail(); } $this->staff_id = null; $this->staff = null; return $this; }
/** * Sets the user, the creator of this post. * * @param kyUser $user User. * @return kyTicketPost */ public function setUser($user) { $this->user = ky_assure_object($user, 'kyUser'); $this->user_id = $this->user !== null ? $this->user->getId() : null; $this->creator = $this->user !== null ? self::CREATOR_USER : null; $this->staff_id = null; $this->staff = null; return $this; }