Example #1
0
 public function getBySQL($query)
 {
     $result = $this->db->exec($query);
     $cx = new \DB\CortexCollection();
     foreach ($result as $row) {
         $new = $this->factory($row);
         $cx->add($new);
         unset($new);
     }
     return $cx;
 }
Example #2
0
 /**
  * Return an array of objects matching criteria
  * @param array|null $filter
  * @param array|null $options
  * @param int        $ttl
  * @return CortexCollection
  */
 public function find($filter = NULL, array $options = NULL, $ttl = 0)
 {
     $result = $this->filteredFind($filter, $options, $ttl);
     if (empty($result)) {
         return false;
     }
     foreach ($result as &$record) {
         $record = $this->factory($record);
         unset($record);
     }
     $cc = new \DB\CortexCollection();
     $cc->setModels($result);
     $this->clearFilter();
     return $cc;
 }