Changeset 6043
- Timestamp:
- 07/09/09 17:56:34 (7 months ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
lib/Doctrine/ORM/Query/Expr.php (modified) (3 diffs)
-
lib/Doctrine/ORM/QueryBuilder.php (modified) (8 diffs)
-
tests/Doctrine/Tests/ORM/Query/ExprTest.php (modified) (1 diff)
-
tests/Doctrine/Tests/ORM/QueryBuilderTest.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Doctrine/ORM/Query/Expr.php
r6030 r6043 70 70 'ltoet' => '_lessThanOrEqualToExpr', 71 71 'between' => '_betweenExpr', 72 'trim' => '_trimExpr' 72 'trim' => '_trimExpr', 73 'on' => '_onExpr', 74 'with' => '_withExpr', 75 'from' => '_fromExpr', 76 'innerJoin' => '_innerJoinExpr', 77 'leftJoin' => '_leftJoinExpr' 73 78 ); 74 79 … … 282 287 } 283 288 289 private function _onExpr() 290 { 291 return 'ON ' . $this->_parts[0]; 292 } 293 294 private function _withExpr() 295 { 296 return 'WITH ' . $this->_parts[0]; 297 } 298 299 private function _fromExpr() 300 { 301 return $this->_parts[0] . ' ' . $this->_parts[1]; 302 } 303 304 private function _leftJoinExpr() 305 { 306 return 'LEFT JOIN ' . $this->_parts[0] . '.' . $this->_parts[1] . ' ' 307 . $this->_parts[2] . (isset($this->_parts[3]) ? ' ' . $this->_parts[3] : null); 308 } 309 310 private function _innerJoinExpr() 311 { 312 return 'INNER JOIN ' . $this->_parts[0] . '.' . $this->_parts[1] . ' ' 313 . $this->_parts[2] . (isset($this->_parts[3]) ? ' ' . $this->_parts[3] : null); 314 } 315 284 316 public static function avg($x) 285 317 { … … 481 513 return new self('trim', array($val, $spec, $char)); 482 514 } 515 516 public static function on($x) 517 { 518 return new self('on', array($x)); 519 } 520 521 public static function with($x) 522 { 523 return new self('with', array($x)); 524 } 525 526 public static function from($from, $alias) 527 { 528 return new self('from', array($from, $alias)); 529 } 530 531 public static function leftJoin($parentAlias, $join, $alias, $condition = null) 532 { 533 return new self('leftJoin', array($parentAlias, $join, $alias, $condition)); 534 } 535 536 public static function innerJoin($parentAlias, $join, $alias, $condition = null) 537 { 538 return new self('innerJoin', array($parentAlias, $join, $alias, $condition)); 539 } 483 540 } -
trunk/lib/Doctrine/ORM/QueryBuilder.php
r6030 r6043 47 47 const STATE_CLEAN = 1; 48 48 49 protected $_entityManager; 49 /** 50 * @var EntityManager $em Instance of an EntityManager to use for query 51 */ 52 protected $_em; 53 54 /** 55 * @var array $dqlParts The array of DQL parts collected 56 */ 50 57 protected $_dqlParts = array( 51 58 'select' => array(), … … 58 65 'offset' => array() 59 66 ); 67 68 /** 69 * @var integer $type The type of query this is. Can be select, update or delete 70 */ 60 71 protected $_type = self::SELECT; 72 73 /** 74 * @var integer $state The state of the query object. Can be dirty or clean. 75 */ 61 76 protected $_state = self::STATE_CLEAN; 77 78 /** 79 * @var string $dql The complete DQL string for this query 80 */ 62 81 protected $_dql; 63 82 83 /** 84 * @var array $params Parameters of this query. 85 */ 86 protected $_params = array(); 87 64 88 public function __construct(EntityManager $entityManager) 65 89 { 66 $this->_e ntityManager= $entityManager;90 $this->_em = $entityManager; 67 91 } 68 92 … … 75 99 { 76 100 return $this->_type; 101 } 102 103 public function getEntityManager() 104 { 105 return $this->_em; 77 106 } 78 107 … … 112 141 public function getQuery() 113 142 { 114 $q = new Query($this->_e ntityManager);143 $q = new Query($this->_em); 115 144 $q->setDql($this->getDql()); 145 $q->setParameters($this->getParameters()); 116 146 117 147 return $q; 118 148 } 119 149 120 public function select($select = null) 121 { 150 public function execute($params = array(), $hydrationMode = null) 151 { 152 return $this->getQuery()->execute($params, $hydrationMode); 153 } 154 155 /** 156 * Sets a query parameter. 157 * 158 * @param string|integer $key The parameter position or name. 159 * @param mixed $value The parameter value. 160 */ 161 public function setParameter($key, $value) 162 { 163 $this->_params[$key] = $value; 164 165 return $this; 166 } 167 168 /** 169 * Sets a collection of query parameters. 170 * 171 * @param array $params 172 */ 173 public function setParameters(array $params) 174 { 175 foreach ($params as $key => $value) { 176 $this->setParameter($key, $value); 177 } 178 179 return $this; 180 } 181 182 /** 183 * Get all defined parameters 184 * 185 * @return array Defined parameters 186 */ 187 public function getParameters($params = array()) 188 { 189 if ($params) { 190 return array_merge($this->_params, $params); 191 } 192 return $this->_params; 193 } 194 195 /** 196 * Gets a query parameter. 197 * 198 * @param mixed $key The key (index or name) of the bound parameter. 199 * @return mixed The value of the bound parameter. 200 */ 201 public function getParameter($key) 202 { 203 return isset($this->_params[$key]) ? $this->_params[$key] : null; 204 } 205 206 /** 207 * Add a single DQL query part to the array of parts 208 * 209 * @param string $dqlPartName 210 * @param string $dqlPart 211 * @param string $append 212 * @return QueryBuilder $this 213 */ 214 public function add($dqlPartName, $dqlPart, $append = false) 215 { 216 if ($append) { 217 $this->_dqlParts[$dqlPartName][] = $dqlPart; 218 } else { 219 $this->_dqlParts[$dqlPartName] = array($dqlPart); 220 } 221 222 $this->_state = self::STATE_DIRTY; 223 224 return $this; 225 } 226 227 public function select() 228 { 229 $selects = func_get_args(); 122 230 $this->_type = self::SELECT; 123 231 124 if ( ! $select) {232 if (empty($selects)) { 125 233 return $this; 126 234 } 127 235 128 return $this-> _addDqlQueryPart('select', $select, true);236 return $this->add('select', implode(', ', $selects), true); 129 237 } 130 238 … … 137 245 } 138 246 139 return $this-> _addDqlQueryPart('from', $delete . ' ' . $alias);247 return $this->add('from', Expr::from($delete, $alias)); 140 248 } 141 249 … … 148 256 } 149 257 150 return $this-> _addDqlQueryPart('from', $update . ' ' . $alias);151 } 152 153 public function set($key, $value = null)154 { 155 return $this-> _addDqlQueryPart('set', $key . ' = ' . $value, true);258 return $this->add('from', Expr::from($update, $alias)); 259 } 260 261 public function set($key, $value) 262 { 263 return $this->add('set', Expr::eq($key, $value), true); 156 264 } 157 265 158 266 public function from($from, $alias) 159 267 { 160 return $this->_addDqlQueryPart('from', $from . ' ' . $alias, true); 161 } 162 163 public function join($join, $alias) 164 { 165 return $this->_addDqlQueryPart('from', 'INNER JOIN ' . $join . ' ' . $alias, true); 166 } 167 168 public function innerJoin($join, $alias) 169 { 170 return $this->join($join, $alias); 171 } 172 173 public function leftJoin($join, $alias) 174 { 175 return $this->_addDqlQueryPart('from', 'LEFT JOIN ' . $join . ' ' . $alias, true); 268 return $this->add('from', Expr::from($from, $alias), true); 269 } 270 271 public function innerJoin($parentAlias, $join, $alias, $condition = null) 272 { 273 return $this->add('from', Expr::innerJoin($parentAlias, $join, $alias, $condition), true); 274 } 275 276 public function leftJoin($parentAlias, $join, $alias, $condition = null) 277 { 278 return $this->add('from', Expr::leftJoin($parentAlias, $join, $alias, $condition), true); 176 279 } 177 280 178 281 public function where($where) 179 282 { 180 return $this->_addDqlQueryPart('where', $where, false); 181 } 182 183 public function andWhere($where) 184 { 185 if (count($this->getDqlQueryPart('where')) > 0) { 186 $this->_addDqlQueryPart('where', 'AND', true); 187 } 188 189 return $this->_addDqlQueryPart('where', $where, true); 190 } 191 192 public function orWhere($where) 193 { 194 if (count($this->getDqlQueryPart('where')) > 0) { 195 $this->_addDqlQueryPart('where', 'OR', true); 196 } 197 198 return $this->_addDqlQueryPart('where', $where, true); 283 return $this->add('where', $where, false); 199 284 } 200 285 201 286 public function groupBy($groupBy) 202 287 { 203 return $this-> _addDqlQueryPart('groupBy', $groupBy, false);288 return $this->add('groupBy', $groupBy, false); 204 289 } 205 290 206 291 public function having($having) 207 292 { 208 return $this-> _addDqlQueryPart('having', $having, false);293 return $this->add('having', $having, false); 209 294 } 210 295 211 296 public function andHaving($having) 212 297 { 213 if (count($this-> getDqlQueryPart('having')) > 0) {214 $this-> _addDqlQueryPart('having', 'AND', true);215 } 216 217 return $this-> _addDqlQueryPart('having', $having, true);298 if (count($this->_getDqlQueryPart('having')) > 0) { 299 $this->add('having', 'AND', true); 300 } 301 302 return $this->add('having', $having, true); 218 303 } 219 304 220 305 public function orHaving($having) 221 306 { 222 if (count($this-> getDqlQueryPart('having')) > 0) {223 $this-> _addDqlQueryPart('having', 'OR', true);224 } 225 226 return $this-> _addDqlQueryPart('having', $having, true);307 if (count($this->_getDqlQueryPart('having')) > 0) { 308 $this->add('having', 'OR', true); 309 } 310 311 return $this->add('having', $having, true); 227 312 } 228 313 229 314 public function orderBy($sort, $order) 230 315 { 231 return $this-> _addDqlQueryPart('orderBy', $sort . ' ' . $order, false);316 return $this->add('orderBy', $sort . ' ' . $order, false); 232 317 } 233 318 234 319 public function addOrderBy($sort, $order) 235 320 { 236 return $this-> _addDqlQueryPart('orderBy', $sort . ' ' . $order, true);321 return $this->add('orderBy', $sort . ' ' . $order, true); 237 322 } 238 323 239 324 public function limit($limit) 240 325 { 241 return $this-> _addDqlQueryPart('limit', $limit);326 return $this->add('limit', $limit); 242 327 } 243 328 244 329 public function offset($offset) 245 330 { 246 return $this-> _addDqlQueryPart('offset', $offset);331 return $this->add('offset', $offset); 247 332 } 248 333 … … 333 418 334 419 $str = (isset($options['pre']) ? $options['pre'] : ''); 335 $str .= implode($options['separator'], $this-> getDqlQueryPart($queryPartName));420 $str .= implode($options['separator'], $this->_getDqlQueryPart($queryPartName)); 336 421 $str .= (isset($options['post']) ? $options['post'] : ''); 337 422 … … 339 424 } 340 425 341 private function getDqlQueryPart($queryPartName)426 private function _getDqlQueryPart($queryPartName) 342 427 { 343 428 return $this->_dqlParts[$queryPartName]; 344 429 } 345 430 346 private function _addDqlQueryPart($queryPartName, $queryPart, $append = false) 347 { 348 if ($append) { 349 $this->_dqlParts[$queryPartName][] = $queryPart; 350 } else { 351 $this->_dqlParts[$queryPartName] = array($queryPart); 352 } 353 354 $this->_state = self::STATE_DIRTY; 355 return $this; 431 /** 432 * Proxy method calls to the Expr class to ease the syntax of the query builder 433 * 434 * @param string $method The method name called 435 * @param string $arguments The arguments passed to the method 436 * @return void 437 * @throws \Doctrine\Common\DoctrineException Throws exception if method could not be proxied 438 */ 439 public function __call($method, $arguments) 440 { 441 $class = 'Doctrine\ORM\Query\Expr'; 442 if (method_exists($class, $method)) { 443 return call_user_func_array(array('Doctrine\ORM\Query\Expr', $method), $arguments); 444 } 445 throw \Doctrine\Common\DoctrineException::notImplemented($method, get_class($this)); 356 446 } 357 447 } -
trunk/tests/Doctrine/Tests/ORM/Query/ExprTest.php
r6030 r6043 229 229 $this->assertEquals('u.id IN(1, 2, 3)', (string) Expr::in('u.id', array(1, 2, 3))); 230 230 } 231 232 public function testOnExpr() 233 { 234 $this->assertEquals('ON 1 = 1', (string) Expr::on(Expr::eq(1, 1))); 235 } 236 237 public function testWithExpr() 238 { 239 $this->assertEquals('WITH 1 = 1', (string) Expr::with(Expr::eq(1, 1))); 240 } 241 242 public function testLeftJoinExpr() 243 { 244 $this->assertEquals('LEFT JOIN u.Profile p', (string) Expr::leftJoin('u', 'Profile', 'p')); 245 } 246 247 public function testLeftJoinOnConditionExpr() 248 { 249 $this->assertEquals('LEFT JOIN u.Profile p ON p.user_id = u.id', (string) Expr::leftJoin('u', 'Profile', 'p', Expr::on(Expr::eq('p.user_id', 'u.id')))); 250 } 251 252 public function testLeftJoinWithConditionExpr() 253 { 254 $this->assertEquals('LEFT JOIN u.Profile p WITH p.user_id = u.id', (string) Expr::leftJoin('u', 'Profile', 'p', Expr::with(Expr::eq('p.user_id', 'u.id')))); 255 } 256 257 public function testInnerJoinExpr() 258 { 259 $this->assertEquals('INNER JOIN u.Profile p', (string) Expr::innerJoin('u', 'Profile', 'p')); 260 } 261 262 public function testInnerJoinOnConditionExpr() 263 { 264 $this->assertEquals('INNER JOIN u.Profile p ON p.user_id = u.id', (string) Expr::innerJoin('u', 'Profile', 'p', Expr::on(Expr::eq('p.user_id', 'u.id')))); 265 } 266 267 public function testInnerJoinWithConditionExpr() 268 { 269 $this->assertEquals('INNER JOIN u.Profile p WITH p.user_id = u.id', (string) Expr::innerJoin('u', 'Profile', 'p', Expr::with(Expr::eq('p.user_id', 'u.id')))); 270 } 231 271 } -
trunk/tests/Doctrine/Tests/ORM/QueryBuilderTest.php
r6030 r6043 63 63 } 64 64 65 public function testSelectSetsType() 66 { 67 $qb = QueryBuilder::create($this->_em) 68 ->delete('Doctrine\Tests\Models\CMS\CmsUser', 'u') 69 ->select('u.id', 'u.username'); 70 71 $this->assertEquals($qb->getType(), QueryBuilder::SELECT); 72 } 73 74 public function testDeleteSetsType() 75 { 76 $qb = QueryBuilder::create($this->_em) 77 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 78 ->delete(); 79 80 $this->assertEquals($qb->getType(), QueryBuilder::DELETE); 81 } 82 83 public function testUpdateSetsType() 84 { 85 $qb = QueryBuilder::create($this->_em) 86 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 87 ->update(); 88 89 $this->assertEquals($qb->getType(), QueryBuilder::UPDATE); 90 } 91 65 92 public function testSimpleSelect() 66 93 { 67 94 $qb = QueryBuilder::create($this->_em) 68 95 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 69 ->select('u.id ,u.username');96 ->select('u.id', 'u.username'); 70 97 71 98 $this->assertValidQueryBuilder($qb, 'SELECT u.id, u.username FROM Doctrine\Tests\Models\CMS\CmsUser u'); … … 84 111 $qb = QueryBuilder::create($this->_em) 85 112 ->update('Doctrine\Tests\Models\CMS\CmsUser', 'u') 86 ->set('u.username', ':username' , 'jonwage');113 ->set('u.username', ':username'); 87 114 88 115 $this->assertValidQueryBuilder($qb, 'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.username = :username'); 89 116 } 90 117 91 public function test Join()92 { 93 $qb = QueryBuilder::create($this->_em) 94 ->select('u ,a')95 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 96 -> join('u.articles', 'a');118 public function testInnerJoin() 119 { 120 $qb = QueryBuilder::create($this->_em) 121 ->select('u', 'a') 122 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 123 ->innerJoin('u', 'articles', 'a'); 97 124 98 125 $this->assertValidQueryBuilder($qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles a'); 99 126 } 100 127 101 public function testInnerJoin()102 {103 $qb = QueryBuilder::create($this->_em)104 ->select('u, a')105 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u')106 ->innerJoin('u.articles', 'a');107 108 $this->assertValidQueryBuilder($qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u INNER JOIN u.articles a');109 }110 111 128 public function testLeftJoin() 112 129 { 113 130 $qb = QueryBuilder::create($this->_em) 114 ->select('u ,a')115 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 116 ->leftJoin('u .articles', 'a');131 ->select('u', 'a') 132 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 133 ->leftJoin('u', 'articles', 'a'); 117 134 118 135 $this->assertValidQueryBuilder($qb, 'SELECT u, a FROM Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a'); … … 124 141 ->select('u') 125 142 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 126 ->where('u.id = :uid') 127 ->where('u.id = :id'); 128 129 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id'); 130 } 131 132 public function testAndWhere() 133 { 134 $qb = QueryBuilder::create($this->_em) 135 ->select('u') 136 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 137 ->where('u.id = :id') 138 ->andWhere('u.username = :username'); 139 140 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id AND u.username = :username'); 141 } 142 143 public function testOrWhere() 144 { 145 $qb = QueryBuilder::create($this->_em) 146 ->select('u') 147 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 148 ->where('u.id = :id') 149 ->orWhere('u.username = :username'); 150 151 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id OR u.username = :username'); 152 } 153 154 /* 155 public function testWhereIn() 156 { 157 $qb = QueryBuilder::create($this->_em) 158 ->select('u') 159 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 160 ->whereIn('u.id', array(1)); 161 162 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN(1)'); 163 } 164 165 public function testWhereNotIn() 166 { 167 $qb = QueryBuilder::create($this->_em) 168 ->select('u') 169 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 170 ->whereNotIn('u.id', array(1)); 171 172 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN(1)'); 173 } 174 175 public function testAndWhereIn() 176 { 177 $qb = QueryBuilder::create($this->_em) 178 ->select('u') 179 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 180 ->where('u.id = :id') 181 ->andWhereIn('u.id', array(1, 2, 3)); 182 183 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id AND u.id IN(1, 2, 3)'); 184 } 185 186 public function testAndWhereNotIn() 187 { 188 $qb = QueryBuilder::create($this->_em) 189 ->select('u') 190 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 191 ->where('u.id = :id') 192 ->andWhereNotIn('u.id', array(1, 2, 3)); 193 194 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id AND u.id NOT IN(1, 2, 3)'); 195 } 196 197 public function testOrWhereIn() 198 { 199 $qb = QueryBuilder::create($this->_em) 200 ->select('u') 201 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 202 ->where('u.id = :id') 203 ->orWhereIn('u.id', array(1, 2, 3)); 204 205 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id OR u.id IN(1, 2, 3)'); 206 } 207 208 public function testOrWhereNotIn() 209 { 210 $qb = QueryBuilder::create($this->_em) 211 ->select('u') 212 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 213 ->where('u.id = :id') 214 ->orWhereNotIn('u.id', array(1, 2, 3)); 215 216 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :id OR u.id NOT IN(1, 2, 3)'); 217 } 218 */ 143 ->where('u.id = :uid'); 144 145 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = :uid'); 146 } 219 147 220 148 public function testGroupBy() … … 285 213 } 286 214 215 public function testGetQuery() 216 { 217 $qb = QueryBuilder::create($this->_em) 218 ->select('u') 219 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); 220 $q = $qb->getQuery(); 221 222 $this->assertEquals(get_class($q), 'Doctrine\ORM\Query'); 223 } 224 225 public function testSetParameter() 226 { 227 $qb = QueryBuilder::create($this->_em) 228 ->select('u') 229 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 230 ->where('u.id = :id') 231 ->setParameter('id', 1); 232 233 $q = $qb->getQuery(); 234 235 $this->assertEquals($q->getParameters(), array('id' => 1)); 236 } 237 238 public function testSetParameters() 239 { 240 $qb = QueryBuilder::create($this->_em) 241 ->select('u') 242 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u') 243 ->where('u.username = :username OR u.username = :username2'); 244 245 $qb->setParameters(array('username' => 'jwage', 'username2' => 'jonwage')); 246 247 $q = $qb->getQuery(); 248 249 $this->assertEquals($q->getParameters(), array('username' => 'jwage', 'username2' => 'jonwage')); 250 } 251 252 public function testExprProxyWithMagicCall() 253 { 254 $qb = QueryBuilder::create($this->_em) 255 ->select('u') 256 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); 257 $qb->where($qb->eq('u.id', 1)); 258 259 $this->assertValidQueryBuilder($qb, 'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = 1'); 260 } 261 262 /** 263 * @expectedException \Doctrine\Common\DoctrineException 264 */ 265 public function testInvalidQueryBuilderMethodThrowsException() 266 { 267 $qb = QueryBuilder::create($this->_em) 268 ->select('u') 269 ->from('Doctrine\Tests\Models\CMS\CmsUser', 'u'); 270 $qb->where($qb->blah('u.id', 1)); 271 } 272 287 273 public function testLimit() 288 274 {