1
0
mirror of synced 2024-12-13 06:46:03 +03:00
This commit is contained in:
adamthehutt 2007-12-11 23:03:57 +00:00
parent cf8012fdf0
commit 13b5346a4f

View File

@ -1146,6 +1146,24 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
return $this->createQuery()->execute(array(), $hydrationMode);
}
/**
* 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
@ -1156,14 +1174,13 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
* @param int $hydrationMode Doctrine::FETCH_ARRAY or Doctrine::FETCH_RECORD
* @return Doctrine_Collection
*/
public function findBySql($dql, array $params = array(), $hydrationMode = null)
{
return $this->createQuery()->where($dql)->execute($params, $hydrationMode);
}
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);
}
/**