analogue
analogue copied to clipboard
Automatically eager load not working
Hello, just trying to use eager load: Mapper:
class RoleMap extends EntityMap
{
public $timestamps = true;
protected $with = ['roleStrings'];
public function roleStrings(Role $role)
{
return $this->hasMany($role, RoleString::class);
}
}
If I trying this:
return mapper(Role::class)->find($id);
Relations not loading automatically.
But if I trying this:
return mapper(Role::class)->with(['roleStrings'])->find($id);
OR
return mapper(Role::class, RoleMap::class)->find($id);
All relations was loaded well.
So I'm just want to know there a bug or I doing something wrong?
I made a refactoring of the hydration process but auto eager loading seems to work fine in my test. Can you show me what the dump of return mapper(Role::class)->find($id);
contains ?