Commit 4ec3f397 authored by Taylor Otwell's avatar Taylor Otwell

fixed pagination bug affecting postgres.

parent 09c60d01
# Laravel Change Log # Laravel Change Log
## Version 2.0.5
- Fix: Remove orderings before running pagination queries.
### Upgrading from 2.0.4
- Replace **laravel** directory.
## Version 2.0.4 ## Version 2.0.4
- Feature: Added default parameter to File::get method. - Feature: Added default parameter to File::get method.
......
...@@ -531,11 +531,16 @@ class Query { ...@@ -531,11 +531,16 @@ class Query {
*/ */
public function paginate($per_page = 20, $columns = array('*')) public function paginate($per_page = 20, $columns = array('*'))
{ {
// Calculate the current page for the request. The page number // Because some database engines may throw errors if we leave
// will be validated and adjusted by the Paginator class, // orderings on the query when retrieving the total number
// so we can assume it is valid. // of records, we will remove all of the ordreings and put
// them back on the query after we have the count.
list($orderings, $this->orderings) = array($this->orderings, null);
$page = Paginator::page($total = $this->count(), $per_page); $page = Paginator::page($total = $this->count(), $per_page);
$this->orderings = $orderings;
return Paginator::make($this->for_page($page, $per_page)->get($columns), $total, $per_page); return Paginator::make($this->for_page($page, $per_page)->get($columns), $total, $per_page);
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @version 2.0.4 * @version 2.0.5
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
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