Closed bjornpost closed 9 years ago
@bjornpost that's how we fixed it and haven't had any side effects (ditto for HasOne
).
I haven't had time to think about how that effects the ability to use a different, hypothetical, cache backend like memcached, but it doesn't seem like it would effect it.
Just fiddled around with
includes()
again and noticed that it tries to hydrate objects twice. Most of the time it's just inefficient. But when using the DateTime Type, it throws an exception saying "DateTime::__construct() expects parameter 1 to be string, object given".After some digging; I found that
Schema::hydrate()
is called twice for included DomainObjects. First, it's called from\Pheasant\Collection::hydrate()
(src), second time it's called fromRelationship::get()
, (f.e. BelongsTo (src)).Just calling
return $cached;
in BelongsTo.php fixes the issue, but I'm not sure about possible unwanted side effects./cc @Jud