Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
File: get.php Progetto: 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);
 }