Exemple #1
0
 /**
  * Returns all instances that are in the cache
  * @return \Pvik\Database\ORM\EntityArray
  */
 public function getAllCacheInstances()
 {
     $instances = new \Pvik\Database\ORM\EntityArray();
     $instances->setModelTable($this->modelTable);
     foreach ($this->cache as $value) {
         $instances->append($value['Instance']);
     }
     return $instances;
 }
Exemple #2
0
 /**
  * Creates a EntityArray from a select statemet result
  * @param array $parameters
  * @return \Pvik\Database\ORM\EntityArray 
  */
 public function fillEntityArray($result)
 {
     $list = new \Pvik\Database\ORM\EntityArray();
     $list->setModelTable($this);
     while ($data = Manager::getInstance()->fetchAssoc($result)) {
         $classname = $this->getEntityClassName();
         $model = new $classname();
         $model->fill($data);
         $list->append($model);
     }
     return $list;
 }