Open nachitox opened 4 years ago
Sorry for the super late response, I'm not sure how I missed the notification!
If you're using the lazy load plugin you shouldn't need to cache anything that's lazily loaded. It won't try to reload it if the property exists. So, if it's null, it will lazy load, then on following calls it will just return what was loaded on that first request. Let me know if that makes sense.
If you're finding it's repeatedly loading for every call please provide me with a test case as I'd very much like to fix that bug.
@nachitox I think https://github.com/jeremyharris/cakephp-lazyload/pull/27 will fix your problem.
ping @nachitox
Checking in to see if #27 fixed your issue.
Context: I have EntityA which hasOne EntityB that can be NULL.
My problem: I'm trying to cache the association to avoid querying it everytime i call
$entityA->entity_b
, so on the EntityA's Entity file i have:but because entityB is NULL,
_parentGet
returns null and tries to lazyload it everytime.Is there any solution besides changing
$entityA->entity_b
for something else ?