Commit 6a14705a authored by Vincent Talbot's avatar Vincent Talbot

Merge pull request #8 from laravel/develop

Develop
parents c55a8f49 2e836499
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Laravel - A PHP Framework For Web Artisans * Laravel - A PHP Framework For Web Artisans
* *
* @package Laravel * @package Laravel
* @version 3.2.9 * @version 3.2.11
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
...@@ -107,7 +107,7 @@ class Asset_Container { ...@@ -107,7 +107,7 @@ class Asset_Container {
* @param string $source * @param string $source
* @param array $dependencies * @param array $dependencies
* @param array $attributes * @param array $attributes
* @return void * @return Asset_Container
*/ */
public function add($name, $source, $dependencies = array(), $attributes = array()) public function add($name, $source, $dependencies = array(), $attributes = array())
{ {
......
...@@ -333,7 +333,7 @@ abstract class Model { ...@@ -333,7 +333,7 @@ abstract class Model {
* @param string $table * @param string $table
* @param string $foreign * @param string $foreign
* @param string $other * @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) public function has_many_and_belongs_to($model, $table = null, $foreign = null, $other = null)
{ {
...@@ -544,7 +544,7 @@ abstract class Model { ...@@ -544,7 +544,7 @@ abstract class Model {
*/ */
public function get_key() public function get_key()
{ {
return array_get($this->original, static::$key); return array_get($this->attributes, static::$key);
} }
/** /**
......
...@@ -87,16 +87,18 @@ class Belongs_To extends Relationship { ...@@ -87,16 +87,18 @@ class Belongs_To extends Relationship {
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($children as &$child) $dictionary = array();
{
$parent = array_first($parents, function($k, $v) use (&$child, $foreign) foreach ($parents as $parent)
{ {
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];
} }
} }
} }
......
...@@ -91,14 +91,19 @@ class Has_Many extends Has_One_Or_Many { ...@@ -91,14 +91,19 @@ class Has_Many extends Has_One_Or_Many {
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_filter($children, function($v) use (&$parent, $foreign) foreach ($children as $child)
{ {
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];
}
} }
} }
......
...@@ -328,14 +328,19 @@ class Has_Many_And_Belongs_To extends Relationship { ...@@ -328,14 +328,19 @@ class Has_Many_And_Belongs_To extends Relationship {
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_filter($children, function($v) use (&$parent, $foreign) foreach ($children as $child)
{ {
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];
}
} }
} }
......
...@@ -38,14 +38,19 @@ class Has_One extends Has_One_Or_Many { ...@@ -38,14 +38,19 @@ class Has_One extends Has_One_Or_Many {
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_first($children, function($k, $v) use (&$parent, $foreign) foreach ($children as $child)
{ {
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];
}
} }
} }
......
...@@ -24,6 +24,16 @@ class Exception extends \Exception { ...@@ -24,6 +24,16 @@ class Exception extends \Exception {
$this->setMessage($sql, $bindings); $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. * Set the exception message to include the SQL and bindings.
* *
......
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
## Contents ## 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) - [Laravel 3.2.9](#3.2.9)
- [Upgrading From 3.2.8](#upgrade-3.2.9) - [Upgrading From 3.2.8](#upgrade-3.2.9)
- [Laravel 3.2.8](#3.2.8) - [Laravel 3.2.8](#3.2.8)
...@@ -43,6 +47,26 @@ ...@@ -43,6 +47,26 @@
- [Laravel 3.1](#3.1) - [Laravel 3.1](#3.1)
- [Upgrading From 3.0](#upgrade-3.1) - [Upgrading From 3.0](#upgrade-3.1)
<a name="3.2.11"></a>
## Laravel 3.2.11
- Improve performance of Eloquent eager load matching.
<a name="upgrade-3.2.11"></a>
### Upgrading From 3.2.10
- Replace the **laravel** folder.
<a name="3.2.10"></a>
## Laravel 3.2.10
- Fix bug in Eloquent model.
<a name="upgrade-3.2.9"></a>
### Upgrading From 3.2.9
- Replace the **laravel** folder.
<a name="3.2.9"></a> <a name="3.2.9"></a>
## Laravel 3.2.9 ## Laravel 3.2.9
......
...@@ -42,5 +42,5 @@ In order to keep the codebase clean, stable and at high quality, even with so ma ...@@ -42,5 +42,5 @@ In order to keep the codebase clean, stable and at high quality, even with so ma
*Further Reading* *Further Reading*
- [Contributing to Laravel via Command-Line](docs/contrib/command-line) - [Contributing to Laravel via Command-Line](/docs/contrib/command-line)
- [Contributing to Laravel using TortoiseGit](docs/contrib/tortoisegit) - [Contributing to Laravel using TortoiseGit](/docs/contrib/tortoisegit)
...@@ -43,7 +43,7 @@ Great! Now that we have an instance of the Redis client, we may issue any of the ...@@ -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); $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)); $values = $redis->run('lrange', array(5, 10));
......
...@@ -196,11 +196,11 @@ Many times, when updating a record, you want to use the unique rule, but exclude ...@@ -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: #### 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: #### 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. > **Note:** The **before** and **after** validation rules use the **strtotime** PHP function to convert your date to something the rule can understand.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
*/ */
function e($value) function e($value)
{ {
return Laravel\HTML::entities($value); return HTML::entities($value);
} }
/** /**
...@@ -23,7 +23,7 @@ function e($value) ...@@ -23,7 +23,7 @@ function e($value)
*/ */
function __($key, $replacements = array(), $language = null) function __($key, $replacements = array(), $language = null)
{ {
return Laravel\Lang::line($key, $replacements, $language); return Lang::line($key, $replacements, $language);
} }
/** /**
......
...@@ -148,6 +148,7 @@ class Profiler { ...@@ -148,6 +148,7 @@ class Profiler {
$binding = Database::connection()->pdo->quote($binding); $binding = Database::connection()->pdo->quote($binding);
$sql = preg_replace('/\?/', $binding, $sql, 1); $sql = preg_replace('/\?/', $binding, $sql, 1);
$sql = htmlspecialchars($sql);
} }
static::$data['queries'][] = array($sql, $time); static::$data['queries'][] = array($sql, $time);
......
...@@ -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 3.2.8 * @version 3.2.11
* @author Taylor Otwell <taylorotwell@gmail.com> * @author Taylor Otwell <taylorotwell@gmail.com>
* @link http://laravel.com * @link http://laravel.com
*/ */
......
...@@ -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 3.2.9 * @version 3.2.11
* @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