-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Public readonly properties are unset in Proxy's constructor #9431
Conversation
The failing test does not seem to fail… |
Yeah, I saw, and did investigate it now on my local. Sorry, after investigation the problem is with public readonly properties, not nullable ones as I thought. Hopefully updated test case is going to show that. I also updated the description. |
Same player try again :P |
Sorry for the test not failing./ It is my first attempt for such a large project.) I am doing it blindly, based on Proxies generated in my local project. I do not have local setup to run tests. I am going to do that, but just now leaving for vacation. So you can expect it around 2022-02-08 I put more info into the description. Each public property is unset in Proxy's constructor. I dig into ProxyGenerator and here is generation of these unsets:
I am going to do failing tests after vacation. |
pretty sure the problem is that |
Aparrently the issue is on The strategy of unset the property to made it lazyloadable will not work on public readonly property and should be ignored. |
@greg0ire I'm using only public in entities and this is preventing me from using it entirely. Is there something specific I can do to support you on this ticket? If it's with some kind of implementation, can you point me to the relevant point in the codebase and documentation for the context? 🙂 |
@christian-kolb I believe there is something you could do that would help: everyone here is pointing to |
I believe public readonly properties cannot be supported for entities that are used as proxy. At least i dont see a way we can implement that in the engine, because it requires unset and __get |
@greg0ire That is what's happening here, isn't it? doctrine/common#957 Perhaps it makes sense to close this pull request here. At the moment there are 2 issues and 2 pull requests over both packages. I haven't even seen the other pull request until I dived into it further 🙂 |
It makes the error go away but breaks lazy loading, so it's not an option |
@beberlei Too bad. So this means you don't think Doctrine will ever be able to offer public readonly properties? |
It depends if we find a way in the engine to hack around this |
Failing Test
Summary
Public readonly properties are unset in Proxy's constructor, which results in error.
Current behavior
Cannot unset readonly property \Entity\SimpleBook::$title from scope Proxies\__CG__\Entity\SimpleBook
How to reproduce
Expected behavior
Code that generates Proxy's constructor
I dug into ProxyGenerator and here is generation of these unsets:
public readonly
properties are not tested as I see in tests.