/**
  * Returns the creator of this comment.
  *
  * Result is cached until the end of script.
  *
  * @param bool $reload True to reload data from server. False to use the cached value (if present).
  * @return kyUser|kyStaff
  * @filterBy
  */
 public function getCreator($reload = false)
 {
     switch ($this->creator_type) {
         case self::CREATOR_TYPE_STAFF:
             if ($this->creator_staff !== null && !$reload) {
                 return $this->creator_staff;
             }
             if ($this->creator_id === null) {
                 return null;
             }
             $this->creator_staff = kyStaff::get($this->creator_id);
             return $this->creator_staff;
         case self::CREATOR_TYPE_USER:
             if ($this->creator_user !== null && !$reload) {
                 return $this->creator_user;
             }
             if ($this->creator_id === null) {
                 return null;
             }
             $this->creator_user = kyUser::get($this->creator_id);
             return $this->creator_user;
     }
     return null;
 }
Esempio n. 2
0
 /**
  * Returns user, the creator of this ticket.
  *
  * Result is cached until the end of script.
  *
  * @param bool $reload True to reload data from server. False to use the cached value (if present).
  * @return kyUser
  */
 public function getUser($reload = false)
 {
     if ($this->user !== null && !$reload) {
         return $this->user;
     }
     if ($this->user_id === null) {
         return null;
     }
     $this->user = kyUser::get($this->user_id);
     return $this->user;
 }
Esempio n. 3
0
 /**
  * Return the user that this note is connected to.
  *
  * Applicable only for notes of type kyTicketNote::TYPE_USER.
  * Result is cached until the end of script.
  *
  * @param bool $reload True to reload data from server. False to use the cached value (if present).
  * @return kyUser
  */
 public function getUser($reload = false)
 {
     if ($this->getType() !== self::TYPE_USER) {
         return null;
     }
     if ($this->user !== null && !$reload) {
         return $this->user;
     }
     if ($this->user_id === null || $this->user_id <= 0) {
         return null;
     }
     $this->user = kyUser::get($this->user_id);
     return $this->user;
 }