diff --git a/artisan b/artisan index 9200cb9a..0c651ff4 100644 --- a/artisan +++ b/artisan @@ -4,7 +4,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.9 + * @version 3.2.11 * @author Taylor Otwell * @link http://laravel.com */ diff --git a/laravel/asset.php b/laravel/asset.php index 6bc36478..57b45465 100644 --- a/laravel/asset.php +++ b/laravel/asset.php @@ -107,7 +107,7 @@ public function __construct($name) * @param string $source * @param array $dependencies * @param array $attributes - * @return void + * @return Asset_Container */ public function add($name, $source, $dependencies = array(), $attributes = array()) { diff --git a/laravel/database/eloquent/model.php b/laravel/database/eloquent/model.php index bdcf6daf..914f94ed 100644 --- a/laravel/database/eloquent/model.php +++ b/laravel/database/eloquent/model.php @@ -333,7 +333,7 @@ public function belongs_to($model, $foreign = null) * @param string $table * @param string $foreign * @param string $other - * @return Relationship + * @return Has_Many_And_Belongs_To */ public function has_many_and_belongs_to($model, $table = null, $foreign = null, $other = null) { @@ -544,7 +544,7 @@ public function get_dirty() */ public function get_key() { - return array_get($this->original, static::$key); + return array_get($this->attributes, static::$key); } /** diff --git a/laravel/database/eloquent/relationships/belongs_to.php b/laravel/database/eloquent/relationships/belongs_to.php index ef257836..79802ee9 100644 --- a/laravel/database/eloquent/relationships/belongs_to.php +++ b/laravel/database/eloquent/relationships/belongs_to.php @@ -87,16 +87,18 @@ public function match($relationship, &$children, $parents) { $foreign = $this->foreign_key(); - foreach ($children as &$child) + $dictionary = array(); + + foreach ($parents as $parent) { - $parent = array_first($parents, function($k, $v) use (&$child, $foreign) - { - return $v->get_key() == $child->$foreign; - }); + $dictionary[$parent->get_key()] = $parent; + } - if ( ! is_null($parent)) + foreach ($children as $child) + { + if (array_key_exists($child->$foreign, $dictionary)) { - $child->relationships[$relationship] = $parent; + $child->relationships[$relationship] = $dictionary[$child->$foreign]; } } } diff --git a/laravel/database/eloquent/relationships/has_many.php b/laravel/database/eloquent/relationships/has_many.php index 726bef20..b791a542 100644 --- a/laravel/database/eloquent/relationships/has_many.php +++ b/laravel/database/eloquent/relationships/has_many.php @@ -91,14 +91,19 @@ public function match($relationship, &$parents, $children) { $foreign = $this->foreign_key(); - foreach ($parents as &$parent) + $dictionary = array(); + + foreach ($children as $child) { - $matching = array_filter($children, function($v) use (&$parent, $foreign) - { - return $v->$foreign == $parent->get_key(); - }); + $dictionary[$child->$foreign][] = $child; + } - $parent->relationships[$relationship] = array_values($matching); + foreach ($parents as $parent) + { + if (array_key_exists($key = $parent->get_key(), $dictionary)) + { + $parent->relationships[$relationship] = $dictionary[$key]; + } } } diff --git a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php index e46d5f96..1c0d3e03 100644 --- a/laravel/database/eloquent/relationships/has_many_and_belongs_to.php +++ b/laravel/database/eloquent/relationships/has_many_and_belongs_to.php @@ -328,14 +328,19 @@ public function match($relationship, &$parents, $children) { $foreign = $this->foreign_key(); - foreach ($parents as &$parent) + $dictionary = array(); + + foreach ($children as $child) { - $matching = array_filter($children, function($v) use (&$parent, $foreign) - { - return $v->pivot->$foreign == $parent->get_key(); - }); + $dictionary[$child->pivot->$foreign][] = $child; + } - $parent->relationships[$relationship] = array_values($matching); + foreach ($parents as $parent) + { + if (array_key_exists($key = $parent->get_key(), $dictionary)) + { + $parent->relationships[$relationship] = $dictionary[$key]; + } } } diff --git a/laravel/database/eloquent/relationships/has_one.php b/laravel/database/eloquent/relationships/has_one.php index 8d1e4ff9..5a9ea760 100644 --- a/laravel/database/eloquent/relationships/has_one.php +++ b/laravel/database/eloquent/relationships/has_one.php @@ -38,14 +38,19 @@ public function match($relationship, &$parents, $children) { $foreign = $this->foreign_key(); - foreach ($parents as &$parent) + $dictionary = array(); + + foreach ($children as $child) { - $matching = array_first($children, function($k, $v) use (&$parent, $foreign) - { - return $v->$foreign == $parent->get_key(); - }); + $dictionary[$child->$foreign] = $child; + } - $parent->relationships[$relationship] = $matching; + foreach ($parents as $parent) + { + if (array_key_exists($key = $parent->get_key(), $dictionary)) + { + $parent->relationships[$relationship] = $dictionary[$key]; + } } } diff --git a/laravel/database/exception.php b/laravel/database/exception.php index a116ad70..d8f425a5 100644 --- a/laravel/database/exception.php +++ b/laravel/database/exception.php @@ -24,6 +24,16 @@ public function __construct($sql, $bindings, \Exception $inner) $this->setMessage($sql, $bindings); } + /** + * Get the inner exception. + * + * @return Exception + */ + public function getInner() + { + return $this->inner; + } + /** * Set the exception message to include the SQL and bindings. * diff --git a/laravel/documentation/changes.md b/laravel/documentation/changes.md index 417e4f85..bac7c82b 100644 --- a/laravel/documentation/changes.md +++ b/laravel/documentation/changes.md @@ -2,6 +2,10 @@ ## Contents +- [Laravel 3.2.11](#3.2.11) +- [Upgrading From 3.2.10](#upgrade-3.2.11) +- [Laravel 3.2.10](#3.2.10) +- [Upgrading From 3.2.9](#upgrade-3.2.10) - [Laravel 3.2.9](#3.2.9) - [Upgrading From 3.2.8](#upgrade-3.2.9) - [Laravel 3.2.8](#3.2.8) @@ -43,6 +47,26 @@ - [Laravel 3.1](#3.1) - [Upgrading From 3.0](#upgrade-3.1) + +## Laravel 3.2.11 + +- Improve performance of Eloquent eager load matching. + + +### Upgrading From 3.2.10 + +- Replace the **laravel** folder. + + +## Laravel 3.2.10 + +- Fix bug in Eloquent model. + + +### Upgrading From 3.2.9 + +- Replace the **laravel** folder. + ## Laravel 3.2.9 diff --git a/laravel/documentation/contrib/github.md b/laravel/documentation/contrib/github.md index ceeac76e..7d3687ec 100644 --- a/laravel/documentation/contrib/github.md +++ b/laravel/documentation/contrib/github.md @@ -42,5 +42,5 @@ In order to keep the codebase clean, stable and at high quality, even with so ma *Further Reading* - - [Contributing to Laravel via Command-Line](docs/contrib/command-line) - - [Contributing to Laravel using TortoiseGit](docs/contrib/tortoisegit) + - [Contributing to Laravel via Command-Line](/docs/contrib/command-line) + - [Contributing to Laravel using TortoiseGit](/docs/contrib/tortoisegit) diff --git a/laravel/documentation/database/redis.md b/laravel/documentation/database/redis.md index 8abdd5cc..42c6d90e 100644 --- a/laravel/documentation/database/redis.md +++ b/laravel/documentation/database/redis.md @@ -43,7 +43,7 @@ Great! Now that we have an instance of the Redis client, we may issue any of the $values = $redis->lrange('names', 5, 10); -Notice the arguments to the comment are simply passed into the magic method. Of course, you are not required to use the magic methods, you may also pass commands to the server using the **run** method: +Notice the arguments to the command are simply passed into the magic method. Of course, you are not required to use the magic methods, you may also pass commands to the server using the **run** method: $values = $redis->run('lrange', array(5, 10)); diff --git a/laravel/documentation/validation.md b/laravel/documentation/validation.md index 0f17dec0..c717276a 100644 --- a/laravel/documentation/validation.md +++ b/laravel/documentation/validation.md @@ -196,11 +196,11 @@ Many times, when updating a record, you want to use the unique rule, but exclude #### Validate that a date attribute is before a given date: - 'birthdate' => 'before:1986-28-05'; + 'birthdate' => 'before:1986-05-28'; #### Validate that a date attribute is after a given date: - 'birthdate' => 'after:1986-28-05'; + 'birthdate' => 'after:1986-05-28'; > **Note:** The **before** and **after** validation rules use the **strtotime** PHP function to convert your date to something the rule can understand. diff --git a/laravel/helpers.php b/laravel/helpers.php index 589669ce..33160dd7 100644 --- a/laravel/helpers.php +++ b/laravel/helpers.php @@ -10,7 +10,7 @@ */ function e($value) { - return Laravel\HTML::entities($value); + return HTML::entities($value); } /** @@ -23,7 +23,7 @@ function e($value) */ function __($key, $replacements = array(), $language = null) { - return Laravel\Lang::line($key, $replacements, $language); + return Lang::line($key, $replacements, $language); } /** diff --git a/laravel/profiling/profiler.php b/laravel/profiling/profiler.php index 360e4702..a26396ee 100644 --- a/laravel/profiling/profiler.php +++ b/laravel/profiling/profiler.php @@ -148,6 +148,7 @@ public static function query($sql, $bindings, $time) $binding = Database::connection()->pdo->quote($binding); $sql = preg_replace('/\?/', $binding, $sql, 1); + $sql = htmlspecialchars($sql); } static::$data['queries'][] = array($sql, $time); diff --git a/paths.php b/paths.php index bd870438..b9ab9229 100644 --- a/paths.php +++ b/paths.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.8 + * @version 3.2.11 * @author Taylor Otwell * @link http://laravel.com */ diff --git a/public/index.php b/public/index.php index f58e72f6..d133794a 100644 --- a/public/index.php +++ b/public/index.php @@ -3,7 +3,7 @@ * Laravel - A PHP Framework For Web Artisans * * @package Laravel - * @version 3.2.9 + * @version 3.2.11 * @author Taylor Otwell * @link http://laravel.com */