4
* Extended Doctrine_Query to provide safe and additional methods
8
* LICENSE: This source file is subject to LGPLv2.1 license
9
* that is available through the world-wide-web at the following URI:
10
* http://www.gnu.org/licenses/lgpl-2.1.html
12
* @author Chad Heuschober, CUNY SPS
14
* Copyright of the Sahana Software Foundation, sahanafoundation.org
16
class agDoctrineQuery extends Doctrine_Query
18
// these constants map to the custom hydration methods provides in this project
19
const HYDRATE_ASSOC_THREE_DIM = 'assoc_three_dim',
20
HYDRATE_ASSOC_TWO_DIM = 'assoc_two_dim',
21
HYDRATE_ASSOC_ONE_DIM = 'assoc_one_dim',
22
HYDRATE_KEY_VALUE_PAIR = 'key_value_pair',
23
HYDRATE_KEY_VALUE_ARRAY = 'key_value_array',
24
HYDRATE_SINGLE_VALUE_ARRAY = 'single_value_array';
27
* Extends the existing whereIn method so that a negative clause (WHERE FALSE) is returned if
28
* the the $params array is empty.
30
* $q->whereIn('u.id', array(10, 23, 44));
33
* @param string $expr The operand of the IN
34
* @param mixed $params An array of parameters or a simple scalar
35
* @param boolean $not Whether or not to use NOT in front of IN. Defaults to false (simple IN clause)
36
* @return Doctrine_Query this object.
38
public function andWhereIn($expr, $params = array(), $not = false)
40
// if there's no params, return a negative match
41
if (isset($params) and (count($params) == 0)) {
42
return $this->andWhere('?', FALSE) ;
45
return parent::andWhereIn($expr, $params, $not) ;
b'\\ No newline at end of file'