Merge branch 'develop' of github.com:laravel/laravel into develop

This commit is contained in:
Taylor Otwell
2011-08-18 18:09:14 -05:00
3 changed files with 15 additions and 7 deletions

View File

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

View File

@@ -60,6 +60,8 @@ ini_set('display_errors', 'Off');
set_exception_handler(function($e) set_exception_handler(function($e)
{ {
require_once SYS_PATH.'exception/handler'.EXT; require_once SYS_PATH.'exception/handler'.EXT;
require_once SYS_PATH.'exception/examiner'.EXT;
require_once SYS_PATH.'file'.EXT;
Exception\Handler::make($e)->handle(); Exception\Handler::make($e)->handle();
}); });
@@ -67,6 +69,8 @@ set_exception_handler(function($e)
set_error_handler(function($number, $error, $file, $line) set_error_handler(function($number, $error, $file, $line)
{ {
require_once SYS_PATH.'exception/handler'.EXT; require_once SYS_PATH.'exception/handler'.EXT;
require_once SYS_PATH.'exception/examiner'.EXT;
require_once SYS_PATH.'file'.EXT;
Exception\Handler::make(new \ErrorException($error, $number, 0, $file, $line))->handle(); Exception\Handler::make(new \ErrorException($error, $number, 0, $file, $line))->handle();
}); });
@@ -76,6 +80,8 @@ register_shutdown_function(function()
if ( ! is_null($error = error_get_last())) if ( ! is_null($error = error_get_last()))
{ {
require_once SYS_PATH.'exception/handler'.EXT; require_once SYS_PATH.'exception/handler'.EXT;
require_once SYS_PATH.'exception/examiner'.EXT;
require_once SYS_PATH.'file'.EXT;
extract($error); extract($error);

View File

@@ -1,4 +1,4 @@
<?php namespace System; <?php namespace Laravel;
class View { class View {
@@ -158,7 +158,7 @@ class View {
if ( ! file_exists($this->path.$view.EXT)) if ( ! file_exists($this->path.$view.EXT))
{ {
throw new \Exception("View [$view] does not exist."); Exception\Handler::make(new Exception("View [$view] does not exist."))->handle();
} }
foreach ($this->data as &$data) foreach ($this->data as &$data)