public function to_array() { $array = parent::to_array(); $array['use_admin'] = $this->can('use_admin'); $array['users'] = User::count(['conditions' => ['group_id = ?', $this->id]]); return $array; }
/** * @return array */ public function to_array() { return array_merge(['author' => $this->author->to_array(), 'user' => $this->user->to_array()], parent::to_array()); }
/** * @return array */ public function to_array() { return array_merge(['author' => $this->author->to_array(), 'forum' => $this->forum->to_array(), 'close' => $this->close_id ? $this->close->to_array() : [], 'posts' => intval(ForumPost::count(['conditions' => ['theme_id = ?', $this->id]]))], parent::to_array()); }
/** * @return array */ public function to_array() { return array_merge(['author' => $this->author->to_array(), 'forum' => $this->forum_id ? $this->forum->to_array() : [], 'subjects' => $this->forum_id ? 0 : Forum::count(['conditions' => ['forum_id = ?', $this->id]]), 'topics' => $this->forum_id ? ForumTheme::count(['conditions' => ['forum_id = ?', $this->id]]) : 0], parent::to_array()); }
/** * @return array */ public function to_array() { return array_merge(['author' => $this->author->to_array(), 'category' => $this->category->to_array(), 'tags' => array_map(function ($i) { return trim($i, ' ,'); }, explode(' ', $this->keywords))], parent::to_array()); }
/** * @return array|null */ public function to_array() { if (!$this->id) { return null; } $user = parent::to_array(); unset($user['session_id'], $user['password']); return array_merge(array('banned' => $this->banned(), 'ban_user' => $this->ban_user ? $this->ban_user->to_array() : [], 'group' => $this->group->to_array(), 'permissions' => $this->getPermissions()->getArrayCopy()), $user); }
/** * @return array */ public function to_array() { return array_merge(['author' => $this->author->to_array(), 'parent' => $this->parent ? $this->parent->to_array() : []], parent::to_array()); }