Merge pull request #8 from laravel/develop

Develop
This commit is contained in:
Vincent Talbot 2012-10-15 05:09:22 -07:00
commit 6a14705a63
16 changed files with 94 additions and 42 deletions

View File

@ -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
*/ */

View File

@ -107,7 +107,7 @@ public function __construct($name)
* @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())
{ {

View File

@ -333,7 +333,7 @@ public function belongs_to($model, $foreign = null)
* @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 @@ public function get_dirty()
*/ */
public function get_key() public function get_key()
{ {
return array_get($this->original, static::$key); return array_get($this->attributes, static::$key);
} }
/** /**

View File

@ -87,16 +87,18 @@ public function match($relationship, &$children, $parents)
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($children as &$child) $dictionary = array();
{
$parent = array_first($parents, function($k, $v) use (&$child, $foreign)
{
return $v->get_key() == $child->$foreign;
});
if ( ! is_null($parent)) foreach ($parents as $parent)
{
$dictionary[$parent->get_key()] = $parent;
}
foreach ($children as $child)
{
if (array_key_exists($child->$foreign, $dictionary))
{ {
$child->relationships[$relationship] = $parent; $child->relationships[$relationship] = $dictionary[$child->$foreign];
} }
} }
} }

View File

@ -91,14 +91,19 @@ public function match($relationship, &$parents, $children)
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_filter($children, function($v) use (&$parent, $foreign)
{
return $v->$foreign == $parent->get_key();
});
$parent->relationships[$relationship] = array_values($matching); foreach ($children as $child)
{
$dictionary[$child->$foreign][] = $child;
}
foreach ($parents as $parent)
{
if (array_key_exists($key = $parent->get_key(), $dictionary))
{
$parent->relationships[$relationship] = $dictionary[$key];
}
} }
} }

View File

@ -328,14 +328,19 @@ public function match($relationship, &$parents, $children)
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_filter($children, function($v) use (&$parent, $foreign)
{
return $v->pivot->$foreign == $parent->get_key();
});
$parent->relationships[$relationship] = array_values($matching); foreach ($children as $child)
{
$dictionary[$child->pivot->$foreign][] = $child;
}
foreach ($parents as $parent)
{
if (array_key_exists($key = $parent->get_key(), $dictionary))
{
$parent->relationships[$relationship] = $dictionary[$key];
}
} }
} }

View File

@ -38,14 +38,19 @@ public function match($relationship, &$parents, $children)
{ {
$foreign = $this->foreign_key(); $foreign = $this->foreign_key();
foreach ($parents as &$parent) $dictionary = array();
{
$matching = array_first($children, function($k, $v) use (&$parent, $foreign)
{
return $v->$foreign == $parent->get_key();
});
$parent->relationships[$relationship] = $matching; foreach ($children as $child)
{
$dictionary[$child->$foreign] = $child;
}
foreach ($parents as $parent)
{
if (array_key_exists($key = $parent->get_key(), $dictionary))
{
$parent->relationships[$relationship] = $dictionary[$key];
}
} }
} }

View File

@ -24,6 +24,16 @@ public function __construct($sql, $bindings, \Exception $inner)
$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.
* *

View File

@ -2,6 +2,10 @@ # Laravel Change Log
## 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 @@ ## Contents
- [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

View File

@ -42,5 +42,5 @@ ## Pull Requests
*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)

View File

@ -43,7 +43,7 @@ ## Usage
$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));

View File

@ -196,11 +196,11 @@ ### Dates
#### 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.

View File

@ -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)
*/ */
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);
} }
/** /**

View File

@ -148,6 +148,7 @@ public static function query($sql, $bindings, $time)
$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);

View File

@ -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
*/ */

View File

@ -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
*/ */