Skip to content

Commit

Permalink
Merge pull request #8 from laravel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vtalbot committed Oct 15, 2012
2 parents c55a8f4 + 2e83649 commit 6a14705
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 38 deletions.
2 changes: 1 addition & 1 deletion artisan
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.2.9
* @version 3.2.11
* @author Taylor Otwell <[email protected]>
* @link http://laravel.com
*/
Expand Down
2 changes: 1 addition & 1 deletion laravel/asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
{
Expand Down
4 changes: 2 additions & 2 deletions laravel/database/eloquent/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}

/**
Expand Down
16 changes: 9 additions & 7 deletions laravel/database/eloquent/relationships/belongs_to.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions laravel/database/eloquent/relationships/has_many.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
}

Expand Down
17 changes: 11 additions & 6 deletions laravel/database/eloquent/relationships/has_one.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions laravel/database/exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
24 changes: 24 additions & 0 deletions laravel/documentation/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -43,6 +47,26 @@
- [Laravel 3.1](#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>
## Laravel 3.2.9

Expand Down
4 changes: 2 additions & 2 deletions laravel/documentation/contrib/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion laravel/documentation/database/redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
4 changes: 2 additions & 2 deletions laravel/documentation/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions laravel/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
function e($value)
{
return Laravel\HTML::entities($value);
return HTML::entities($value);
}

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

/**
Expand Down
1 change: 1 addition & 0 deletions laravel/profiling/profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.2.8
* @version 3.2.11
* @author Taylor Otwell <[email protected]>
* @link http://laravel.com
*/
Expand Down
2 changes: 1 addition & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 3.2.9
* @version 3.2.11
* @author Taylor Otwell <[email protected]>
* @link http://laravel.com
*/
Expand Down

0 comments on commit 6a14705

Please sign in to comment.