8000 Merge pull request #823 from Vespakoen/patch-3 · laravel/laravel@5279773 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5279773

Browse files
committed
Merge pull request #823 from Vespakoen/patch-3
ATTENTION! Fixing reference issue in relationship matching (Causing MAMP, and other installs, to crash when eager-loading)
2 parents b27b132 + aeeb010 commit 5279773

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

laravel/database/eloquent/relationships/belongs_to.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function match($relationship, &$children, $parents)
8989

9090
foreach ($children as &$child)
9191
{
92-
$parent = array_first($parents, function($k, $v) use ($child, $foreign)
92+
$parent = array_first($parents, function($k, $v) use (&$child, $foreign)
9393
{
9494
return $v->get_key() == $child->$foreign;
9595
});

laravel/database/eloquent/relationships/has_many.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function match($relationship, &$parents, $children)
9393

9494
foreach ($parents as &$parent)
9595
{
96-
$matching = array_filter($children, function($v) use ($parent, $foreign)
96+
$matching = array_filter($children, function($v) use (&$parent, $foreign)
9797
{
9898
return $v->$foreign == $parent->get_key();
9999
});

laravel/database/eloquent/relationships/has_many_and_belongs_to.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public function match($relationship, &$parents, $children)
327327

328328
foreach ($parents as &$parent)
329329
{
330-
$matching = array_filter($children, function($v) use ($parent, $foreign)
330+
$matching = array_filter($children, function($v) use (&$parent, $foreign)
331331
{
332332
return $v->pivot->$foreign == $parent->get_key();
333333
});

laravel/database/eloquent/relationships/has_one.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function match($relationship, &$parents, $children)
4040

4141
foreach ($parents as &$parent)
4242
{
43-
$matching = array_first($children, function($k, $v) use ($parent, $foreign)
43+
$matching = array_first($children, function($k, $v) use (&$parent, $foreign)
4444
{
4545
return $v->$foreign == $parent->get_key();
4646
});

0 commit comments

Comments
 (0)
0