Changeset 3836
- Timestamp:
- 02/19/08 02:37:09 (17 months ago)
- Files:
-
- 3 modified
-
branches/0.10/lib/Doctrine/Pager.php (modified) (4 diffs)
-
branches/0.9/lib/Doctrine/Pager.php (modified) (4 diffs)
-
trunk/lib/Doctrine/Pager.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine/Pager.php
r3540 r3836 384 384 385 385 /** 386 * getResultsInPage 387 * 388 * Returns the number of itens in current page 389 * 390 * @return int Number of itens in current page 391 */ 392 public function getResultsInPage() 393 { 394 $page = $this->getPage(); 395 396 if ($page != $this->getLastPage()) { 397 return $page * $this->getMaxPerPage(); 398 } 399 400 $offset = ($this->getPage() - 1) * $this->getMaxPerPage(); 401 402 return abs($this->getNumResults() - $offset); 403 } 404 405 406 /** 386 407 * getQuery 387 408 * … … 433 454 * Defines the counter query to be used by pager 434 455 * 435 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 436 * (which does the Doctrine_Query class creation). 437 * @return void 438 */ 439 public function setCountQuery($query) 456 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 457 * (which does the Doctrine_Query class creation). 458 * @param array Optional params to be used by counter Doctrine_Query. 459 * If not defined, the params passed to execute method will be used. 460 * @return void 461 */ 462 public function setCountQuery($query, $params = null) 440 463 { 441 464 if (is_string($query)) { … … 444 467 445 468 $this->_countQuery = $query; 469 470 $this->setCountQueryParams($params); 446 471 447 472 $this->_setExecuted(false); … … 477 502 $this->_countQueryParams = array_merge($this->_countQueryParams, $params); 478 503 } else { 504 if ($params !== null && !is_array($params)) { 505 $params = array($params); 506 } 507 479 508 $this->_countQueryParams = $params; 480 509 } -
branches/0.9/lib/Doctrine/Pager.php
r3540 r3836 384 384 385 385 /** 386 * getResultsInPage 387 * 388 * Returns the number of itens in current page 389 * 390 * @return int Number of itens in current page 391 */ 392 public function getResultsInPage() 393 { 394 $page = $this->getPage(); 395 396 if ($page != $this->getLastPage()) { 397 return $page * $this->getMaxPerPage(); 398 } 399 400 $offset = ($this->getPage() - 1) * $this->getMaxPerPage(); 401 402 return abs($this->getNumResults() - $offset); 403 } 404 405 406 /** 386 407 * getQuery 387 408 * … … 433 454 * Defines the counter query to be used by pager 434 455 * 435 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 436 * (which does the Doctrine_Query class creation). 437 * @return void 438 */ 439 public function setCountQuery($query) 456 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 457 * (which does the Doctrine_Query class creation). 458 * @param array Optional params to be used by counter Doctrine_Query. 459 * If not defined, the params passed to execute method will be used. 460 * @return void 461 */ 462 public function setCountQuery($query, $params = null) 440 463 { 441 464 if (is_string($query)) { … … 444 467 445 468 $this->_countQuery = $query; 469 470 $this->setCountQueryParams($params); 446 471 447 472 $this->_setExecuted(false); … … 477 502 $this->_countQueryParams = array_merge($this->_countQueryParams, $params); 478 503 } else { 504 if ($params !== null && !is_array($params)) { 505 $params = array($params); 506 } 507 479 508 $this->_countQueryParams = $params; 480 509 } -
trunk/lib/Doctrine/Pager.php
r3570 r3836 384 384 385 385 /** 386 * getResultsInPage 387 * 388 * Returns the number of itens in current page 389 * 390 * @return int Number of itens in current page 391 */ 392 public function getResultsInPage() 393 { 394 $page = $this->getPage(); 395 396 if ($page != $this->getLastPage()) { 397 return $page * $this->getMaxPerPage(); 398 } 399 400 $offset = ($this->getPage() - 1) * $this->getMaxPerPage(); 401 402 return abs($this->getNumResults() - $offset); 403 } 404 405 406 /** 386 407 * getQuery 387 408 * … … 433 454 * Defines the counter query to be used by pager 434 455 * 435 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 436 * (which does the Doctrine_Query class creation). 437 * @return void 438 */ 439 public function setCountQuery($query) 456 * @param Doctrine_Query Accepts either a Doctrine_Query object or a string 457 * (which does the Doctrine_Query class creation). 458 * @param array Optional params to be used by counter Doctrine_Query. 459 * If not defined, the params passed to execute method will be used. 460 * @return void 461 */ 462 public function setCountQuery($query, $params = null) 440 463 { 441 464 if (is_string($query)) { … … 444 467 445 468 $this->_countQuery = $query; 469 470 $this->setCountQueryParams($params); 446 471 447 472 $this->_setExecuted(false); … … 477 502 $this->_countQueryParams = array_merge($this->_countQueryParams, $params); 478 503 } else { 504 if ($params !== null && !is_array($params)) { 505 $params = array($params); 506 } 507 479 508 $this->_countQueryParams = $params; 480 509 }