Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File injection on load not working reliabely with lazy ghost objects #1439

Open
wryk opened this issue Mar 26, 2024 · 0 comments
Open

File injection on load not working reliabely with lazy ghost objects #1439

wryk opened this issue Mar 26, 2024 · 0 comments

Comments

@wryk
Copy link

wryk commented Mar 26, 2024

Bug Report

Q A
BC Break yes
Bundle version 2.3.0
Symfony version 6.4.3
PHP version 8.2.13

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

  • Enable doctrine lazy ghost objects
  • Enable inject_on_load
  • Access the file object on a uninitialized entity

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.

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

No branches or pull requests

1 participant