-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
Switch from #[AllowDynmicProperties] to __set method for data properties #1375
Comments
There are two ways to fix this warning, one is switch to enum that i talked about it months ago, one is to implement ArrayAccess, Laravel's Models used ArrayAccess then I did not get this warning. |
Currently the whole library works with dynamic properties. We didn't discuss how to handle this yet. Implementing a Or we could just add the I don't see how Enums would help at all with the actual problem and dynamic properties. Accessing every property via ArrayAccess would help too, but as I said earlier: The whole library works with dynamic properties, so this would be the most complex and bc-breaking solution of all. We should not do that, as long as there is another way. I think the magic set function would be the best way to go for us. |
yeah, I am in favor of using this scheme magic __set, but i think it will always be a temp way, finally we should define all the properties. |
I read the wiki First of all, sorry for my English, it seems like Btw, i don't think bc break should never happen, PHP is breaking us like this, it may be the time to get into 1.0.0 |
I do not think we should avoid bc breaking changes too, but if we do it should be thoughtful. And with this I think the cost/benefit ratio is very low. The attribute could be a solution, but the docs say itself "As a last resort the class can be marked with the .. attribute". I don't think we should go that way, as long we could do it the "right" way with __set. Happy to hear more thoughts on this. |
I have been programming a port of this library for Yii2. You can see my way of getting properties through getters and setters with Yii Model based entities |
@alesinicio added AllowDynamicProperties for now. I'd like to keep this issue open, so we can at some point make the jump to |
@TiiFuchs I believe I can help with the change for |
Ideally the same thing should happen that happens now, if you access an invalid property. |
Today the engine returns PHP7.4 and less issue a I'll get to work on this very soon and generate a PR. |
This is part of 0.81.0 now |
🐞 Bug Report
Required Information
Summary
Creation of dynamic property is deprecated
Current behaviour
How to reproduce
Use PHP 8.2.0
The text was updated successfully, but these errors were encountered: