Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

DomainObject methods not accessible when using includes() #131

Closed
bjornpost opened this issue Apr 14, 2015 · 2 comments
Closed

DomainObject methods not accessible when using includes() #131

bjornpost opened this issue Apr 14, 2015 · 2 comments

Comments

@bjornpost
Copy link
Collaborator

When using includes(), methods defined on the included DomainObjects are not accessible. For example:

$foo = \Model\Foo::findById(1)->includes(array('Bar'))->first();
var_dump($foo->Bar); // works
var_dump($foo->Bar->myMethod()); // throws error, method is accessible again when removing includes()

Seems like an undocumented regression. Right now ArrayCache::add() adds $object->toArray(), but it should add the entire $object. Will create PR.

/cc @Jud

@Jud
Copy link
Collaborator

Jud commented Apr 14, 2015

@bjornpost ah, this is what I was thinking about when I mentioned memcached in #130. Like you pointed out, not calling ->toArray will work for a local array cache, but, if using something like memcached you'd either need DomainObjects to be serializable (unfortunately not possible #76), or call toArray and hydrate on read.

I'm not sure it matters right now, because the hypothetical memcached pheasant cache doesn't exist, but that's where my head's at.

@bjornpost bjornpost added this to the 1.3.2 milestone Apr 19, 2015
@bjornpost bjornpost removed this from the 1.3.2 milestone Apr 24, 2015
@bjornpost
Copy link
Collaborator Author

Fixed in 594dba8.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants