Commit 13b5346a authored by adamthehutt's avatar adamthehutt

Fix for #669

parent cf8012fd
......@@ -1147,23 +1147,40 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
}
/**
* findByDql
* finds records with given DQL where clause
* findBySql
* finds records with given SQL where clause
* returns a collection of records
*
* @param string $dql DQL after WHERE clause
* @param array $params query parameters
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD
* @return Doctrine_Collection
*
* @todo This actually takes DQL, not SQL, but it requires column names
* instead of field names. This should be fixed to use raw SQL instead.
*/
public function findBySql($dql, array $params = array(), $hydrationMode = null)
{
return $this->createQuery()->where($dql)->execute($params, $hydrationMode);
}
/**
* findByDql
* finds records with given DQL where clause
* returns a collection of records
*
* @param string $dql DQL after WHERE clause
* @param array $params query parameters
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD
* @return Doctrine_Collection
*/
public function findByDql($dql, array $params = array(), $hydrationMode = null)
{
return $this->findBySql($dql, $params, $hydrationMode);
$parser = new Doctrine_Query($this->_conn);
$component = $this->getComponentName();
$query = 'FROM ' . $component . ' WHERE ' . $dql;
return $parser->query($query, $params, $hydrationMode);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment