/** * Return attached files but filter the private ones if user is not a member * of the owner company * * @param void * @return array */ function getAttachedFiles() { if (logged_user()->isMemberOfOwnerCompany()) { return $this->getAllAttachedFiles(); } // if if (is_null($this->attached_files)) { $this->attached_files = AttachedFiles::getFilesByObject($this, true); } // if return $this->attached_files; }