示例#1
0
文件: mssql.php 项目: Borvik/Munla
 protected function to_model($model_class, $results)
 {
     if ($results === false) {
         return false;
     }
     $ret = array();
     while ($row = sqlsrv_fetch_array($results, SQLSRV_FETCH_ASSOC)) {
         $ret[] = model::createNew($model_class, $row);
     }
     if (count($ret) < 1) {
         return false;
     }
     return $ret;
 }
示例#2
0
文件: solr.php 项目: Borvik/Munla
 protected function to_model($model_class, $results)
 {
     if (!isset($results) || $results === false || !isset($results['response']['docs'])) {
         return false;
     }
     $ret = array();
     foreach ($results['response']['docs'] as $product) {
         $ret[] = model::createNew($model_class, $product);
     }
     if (count($ret) < 1) {
         return false;
     }
     return $ret;
 }
示例#3
0
文件: get.php 项目: Borvik/Munla
 /**
  * Gets the requested model.
  * 
  * @param string $name The name of the model to get.
  * @param array|object $values The values that the model should be initialized with.
  * 
  * @return model|null An instance of the model, or null if not found.
  */
 public static function cache_model($name, $values = null)
 {
     if (!isset($values)) {
         $values = array();
     }
     return model::createNew($name, $values);
 }