From dd729886f5628930a2079a8ace060d20e2583578 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 20 Jul 2011 07:07:15 -0700 Subject: [PATCH] Fix has_and_belongs_to_many eager loading initialization bug. --- system/db/eloquent/hydrator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/db/eloquent/hydrator.php b/system/db/eloquent/hydrator.php index b2aa942d..276aa1bf 100644 --- a/system/db/eloquent/hydrator.php +++ b/system/db/eloquent/hydrator.php @@ -87,7 +87,7 @@ private static function eagerly($eloquent, &$parents, $include) // are initialized to an array and "one" relationships are initialized to null. foreach ($parents as &$parent) { - $parent->ignore[$include] = (strpos($eloquent->relating, 'has_many') === 0) ? array() : null; + $parent->ignore[$include] = (in_array($eloquent->relating, array('has_many', 'has_and_belongs_to_many'))) ? array() : null; } if ($eloquent->relating == 'has_one')