fixed bug in eloquent causing ids to overlap.

This commit is contained in:
Taylor Otwell
2011-09-14 20:55:58 -05:00
parent 174d50c044
commit 6904cf119d
2 changed files with 6 additions and 8 deletions

View File

@@ -3,7 +3,7 @@
* Laravel - A clean and classy framework for PHP web development. * Laravel - A clean and classy framework for PHP web development.
* *
* @package Laravel * @package Laravel
* @version 1.5.8 * @version 1.5.9
* @author Taylor Otwell * @author Taylor Otwell
* @link http://laravel.com * @link http://laravel.com
*/ */

View File

@@ -194,10 +194,8 @@ abstract class Model {
* *
* @return array * @return array
*/ */
private function _get($columns = array('*')) private function _get()
{ {
$this->query->select($columns);
return Hydrator::hydrate($this); return Hydrator::hydrate($this);
} }
@@ -206,9 +204,9 @@ abstract class Model {
* *
* @return mixed * @return mixed
*/ */
private function _first($columns = array('*')) private function _first()
{ {
return (count($results = $this->take(1)->_get($columns)) > 0) ? reset($results) : null; return (count($results = $this->take(1)->_get()) > 0) ? reset($results) : null;
} }
/** /**
@@ -217,7 +215,7 @@ abstract class Model {
* @param int $per_page * @param int $per_page
* @return Paginator * @return Paginator
*/ */
private function _paginate($per_page = null, $columns = array('*')) private function _paginate($per_page = null)
{ {
$total = $this->query->count(); $total = $this->query->count();
@@ -226,7 +224,7 @@ abstract class Model {
$per_page = (property_exists(get_class($this), 'per_page')) ? static::$per_page : 20; $per_page = (property_exists(get_class($this), 'per_page')) ? static::$per_page : 20;
} }
return Paginator::make($this->select($columns)->for_page(Paginator::page($total, $per_page), $per_page)->get(), $total, $per_page); return Paginator::make($this->for_page(Paginator::page($total, $per_page), $per_page)->get(), $total, $per_page);
} }
/** /**