You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
inject_on_load option doesn't work as previously expected when doctrine use lazy ghost objects (since doctrine/orm 3.0.0 or below when enabling them).
According to doctrine/DoctrineBundle#1651 (comment) this might be an expected behavior of the new proxy internal (and might wontfix in doctrine) so this is why I address this issue here.
Current behavior
When accessing the file object on a uninitialized entity the file is not injected.
Without lazy ghost objects the injection worked fine, I expect the inject_on_load to work without having to ensure the entity is not a proxy or is initialized.
If not practically fixable in the bundle this regression should be documented or maybe because of the reliability issue inject_on_load should be replaced/removed.
The text was updated successfully, but these errors were encountered:
You can work around this by adding this to the start of your entity's file getter:
if ($thisinstanceofDoctrine\Persistence\Proxy) {
$this->__load();
}
This forces Doctrine to load your entity (and thus call the listener that injects the file) when the getter is called (which happened automatically before lazy ghost objects, but doesn't anymore).
Bug Report
Summary
inject_on_load
option doesn't work as previously expected when doctrine use lazy ghost objects (since doctrine/orm 3.0.0 or below when enabling them).According to doctrine/DoctrineBundle#1651 (comment) this might be an expected behavior of the new proxy internal (and might wontfix in doctrine) so this is why I address this issue here.
Current behavior
When accessing the file object on a uninitialized entity the file is not injected.
How to reproduce
Reproducible example : https://github.com/wryk/vich-uploader-issue-1439-lazy-ghost-inject-load
Expected behavior
Without lazy ghost objects the injection worked fine, I expect the
inject_on_load
to work without having to ensure the entity is not a proxy or is initialized.If not practically fixable in the bundle this regression should be documented or maybe because of the reliability issue
inject_on_load
should be replaced/removed.The text was updated successfully, but these errors were encountered: