示例#1
0
文件: Query.php 项目: moiseh/codegen
 public function __construct($attrs = array())
 {
     parent::__construct($attrs);
     // convert
     if (!is_array($this->searchFields)) {
         $this->searchFields = explode(',', $this->searchFields);
     }
 }
示例#2
0
文件: Page.php 项目: moiseh/codegen
 public function __construct($properties = array())
 {
     $this->objects = array();
     $this->restrict = false;
     parent::__construct($properties);
     // convert data
     if (is_array($this->menu)) {
         $this->menu = new \Meta\Menu\Item($this->menu);
     }
 }
示例#3
0
文件: User.php 项目: moiseh/codegen
 public function __construct($id = null)
 {
     if ($id) {
         $row = (array) Db::query('select id, login, name, isAdmin from users where id = ?', array($id))->fetch(\PDO::FETCH_ASSOC);
         // let Base class to set properties
         if (is_array($row)) {
             parent::__construct($row);
         }
         $this->groups = Db::query('select group_id, groups.name from user_groups inner join groups on (groups.id = user_groups.group_id) where user_id = ? order by groups.name', array($id))->fetchAll(\PDO::FETCH_KEY_PAIR);
         $this->groupPages = Db::query('select distinct p.page from user_groups inner join groups on (groups.id = user_groups.group_id) inner join group_pages p on (p.group_id = groups.id) where user_id = ?', array($id))->fetchAll(\PDO::FETCH_COLUMN);
     }
 }