fixed belongs_to eager loading bug when parent does not exist.
This commit is contained in:
@@ -200,10 +200,13 @@ class Hydrator {
|
|||||||
// Match the child models with their parent by ID.
|
// Match the child models with their parent by ID.
|
||||||
// -----------------------------------------------------
|
// -----------------------------------------------------
|
||||||
foreach ($parents as &$parent)
|
foreach ($parents as &$parent)
|
||||||
|
{
|
||||||
|
if (array_key_exists($parent->$relating_key, $children))
|
||||||
{
|
{
|
||||||
$parent->ignore[$include] = $children[$parent->$relating_key];
|
$parent->ignore[$include] = $children[$parent->$relating_key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Eagerly load a many-to-many relationship.
|
* Eagerly load a many-to-many relationship.
|
||||||
|
|||||||
Reference in New Issue
Block a user