Exemplo n.º 1
0
 /**
  * Factory method of object creation is preferable to use, cf. method  __construct() description
  *
  * @param string $name
  * @param integer | array $id
  * @throws Exception
  * @return Db_Object | array
  */
 public static function factory($name, $id = false)
 {
     if (!is_array($id)) {
         return new Db_Object($name, $id);
     }
     $list = array();
     $model = Model::factory($name);
     $data = $model->getItems($id);
     static::$_disableAclCheck = true;
     foreach ($data as $item) {
         $o = new Db_Object($name);
         $o->setId($item[$o->_primaryKey]);
         $o->_setRawData($item);
         $list[$item[$o->_primaryKey]] = $o;
     }
     static::$_disableAclCheck = false;
     return $list;
 }