private function find($criteria)
 {
     $queryBuilder = new QueryBuilder();
     $query = $queryBuilder->find($this->table, $criteria);
     $result = $this->employ->execute($query);
     $sqlResult = array();
     foreach ($result as $key => $record) {
         $sqlResult[] = new Entity($this->table, $record);
     }
     return $sqlResult;
 }
 public function save(Entity $object)
 {
     $queryBuilder = new QueryBuilder();
     if ($object->id) {
         $result = $this->getRepository($object->tableName)->findOneBy(array('id' => $object->getId()));
     }
     if (isset($result) && !empty($result)) {
         $query = $queryBuilder->update($object);
         $this->employ->execute($query, false);
     } else {
         $query = $queryBuilder->create($object);
         $this->employ->execute($query, false);
     }
 }
Example #3
0
 public function table($table)
 {
     $query = new QueryBuilder($this);
     return $query->from($table);
 }