Exemplo n.º 1
0
 /**
  *
  */
 public function findAll(\Gacela\DataSource\Query\Query $query, \Gacela\DataSource\Resource $resource, array $inherits, array $dependents)
 {
     if (!count($query->from) > 0) {
         $query->from($resource->getName(), array_keys($resource->getFields()));
     }
     return $this->query($resource, $query);
 }
Exemplo n.º 2
0
 /**
  * @see Gacela\DataSource\iDataSource::delete()
  * @throws \Exception
  * @param  $name
  * @param \Gacela\DataSource\Query\Sql $where
  * @return bool
  */
 public function delete($name, \Gacela\DataSource\Query\Query $where)
 {
     $this->_setLastQuery($where->delete($name));
     $query = $this->_adapter->prepare($this->_lastQuery['query']);
     if ($query->execute($this->_lastQuery['args'])) {
         if ($query->rowCount() == 0) {
             return false;
         }
         return true;
     } else {
         throw new \Exception('Update failed with errors: <pre>' . print_r($query->errorInfo(), true) . print_r($query, true) . '</pre>');
     }
 }