コード例 #1
0
ファイル: table.php プロジェクト: NavaINT1876/ccustoms
 /**
  * Performs a query to the database and returns the representing list of objects
  *
  * This method will run the query and then build the list of objects that represent
  * the records of the table. It will also init the objects with the basic properties
  * like the reference to the global App object
  *
  * @param string $query The query to perform
  *
  * @return array The list of objects representing the records
  */
 protected function _queryObjectList($query)
 {
     // query database
     $result = $this->database->query($query);
     // fetch objects and execute init callback
     $objects = array();
     while ($object = $this->database->fetchObject($result, $this->class)) {
         $objects[$object->{$this->key}] = $this->_initObject($object);
     }
     $this->database->freeResult($result);
     return $objects;
 }