Skip to content

Commit 3416506

Browse files
committed
increment version. refactor eloquent eager loading matching.
1 parent 1df8fa9 commit 3416506

File tree

8 files changed

+35
-24
lines changed

8 files changed

+35
-24
lines changed

artisan

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Laravel - A PHP Framework For Web Artisans
55
*
66
* @package Laravel
7-
* @version 3.2.10
7+
* @version 3.2.11
88
* @author Taylor Otwell <taylorotwell@gmail.com>
99
* @link http://laravel.com
1010
*/

laravel/database/eloquent/relationships/belongs_to.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,18 @@ public function match($relationship, &$children, $parents)
8787
{
8888
$foreign = $this->foreign_key();
8989

90-
$parents_hash = array();
90+
$dictionary = array();
91+
9192
foreach ($parents as $parent)
9293
{
93-
$parents_hash[$parent->get_key()] = $parent;
94+
$dictionary[$parent->get_key()] = $parent;
9495
}
9596

9697
foreach ($children as $child)
9798
{
98-
if (array_key_exists($child->$foreign, $parents_hash))
99+
if (array_key_exists($child->$foreign, $dictionary))
99100
{
100-
$child->relationships[$relationship] = $parents_hash[$child->$foreign];
101+
$child->relationships[$relationship] = $dictionary[$child->$foreign];
101102
}
102103
}
103104
}

laravel/database/eloquent/relationships/has_many.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,18 @@ public function match($relationship, &$parents, $children)
9191
{
9292
$foreign = $this->foreign_key();
9393

94-
$children_hash = array();
94+
$dictionary = array();
95+
9596
foreach ($children as $child)
9697
{
97-
$children_hash[$child->$foreign][] = $child;
98+
$dictionary[$child->$foreign][] = $child;
9899
}
99100

100101
foreach ($parents as $parent)
101102
{
102-
if (array_key_exists($parent->get_key(), $children_hash))
103+
if (array_key_exists($key = $parent->get_key(), $dictionary))
103104
{
104-
$parent->relationships[$relationship] = $children_hash[$parent->get_key()];
105+
$parent->relationships[$relationship] = $dictionary[$key];
105106
}
106107
}
107108
}

laravel/database/eloquent/relationships/has_many_and_belongs_to.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,18 @@ public function match($relationship, &$parents, $children)
328328
{
329329
$foreign = $this->foreign_key();
330330

331-
$children_hash = array();
331+
$dictionary = array();
332+
332333
foreach ($children as $child)
333334
{
334-
$children_hash[$child->pivot->$foreign][] = $child;
335+
$dictionary[$child->pivot->$foreign][] = $child;
335336
}
336337

337338
foreach ($parents as $parent)
338339
{
339-
if (array_key_exists($parent->get_key(), $children_hash))
340+
if (array_key_exists($key = $parent->get_key(), $dictionary))
340341
{
341-
$parent->relationships[$relationship] = $children_hash[$parent->get_key()];
342+
$parent->relationships[$relationship] = $dictionary[$key];
342343
}
343344
}
344345
}

laravel/database/eloquent/relationships/has_one.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,18 @@ public function match($relationship, &$parents, $children)
3838
{
3939
$foreign = $this->foreign_key();
4040

41-
$children_hash = array();
41+
$dictionary = array();
42+
4243
foreach ($children as $child)
4344
{
44-
if (array_key_exists($child->$foreign, $children_hash))
45-
{
46-
continue;
47-
}
48-
49-
$children_hash[$child->$foreign] = $child;
45+
$dictionary[$child->$foreign] = $child;
5046
}
5147

5248
foreach ($parents as $parent)
5349
{
54-
if (array_key_exists($parent->get_key(), $children_hash))
50+
if (array_key_exists($key = $parent->get_key(), $dictionary))
5551
{
56-
$parent->relationships[$relationship] = $children_hash[$parent->get_key()];
52+
$parent->relationships[$relationship] = $dictionary[$key];
5753
}
5854
}
5955
}

laravel/documentation/changes.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Contents
44

5+
- [Laravel 3.2.11](#3.2.11)
6+
- [Upgrading From 3.2.10](#upgrade-3.2.11)
57
- [Laravel 3.2.10](#3.2.10)
68
- [Upgrading From 3.2.9](#upgrade-3.2.10)
79
- [Laravel 3.2.9](#3.2.9)
@@ -45,6 +47,16 @@
4547
- [Laravel 3.1](#3.1)
4648
- [Upgrading From 3.0](#upgrade-3.1)
4749

50+
<a name="3.2.11"></a>
51+
## Laravel 3.2.11
52+
53+
- Improve performance of Eloquent eager load matching.
54+
55+
<a name="upgrade-3.2.11"></a>
56+
### Upgrading From 3.2.10
57+
58+
- Replace the **laravel** folder.
59+
4860
<a name="3.2.10"></a>
4961
## Laravel 3.2.10
5062

paths.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Laravel - A PHP Framework For Web Artisans
44
*
55
* @package Laravel
6-
* @version 3.2.10
6+
* @version 3.2.11
77
* @author Taylor Otwell <taylorotwell@gmail.com>
88
* @link http://laravel.com
99
*/

public/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Laravel - A PHP Framework For Web Artisans
44
*
55
* @package Laravel
6-
* @version 3.2.10
6+
* @version 3.2.11
77
* @author Taylor Otwell <taylorotwell@gmail.com>
88
* @link http://laravel.com
99
*/

0 commit comments

Comments
 (0)