-
-
Notifications
You must be signed in to change notification settings - Fork 173
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
Don’t pass kirby as property to models #6072
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing the app object as property indeed seems superfluous as it isn't used anywhere at the moment. I can't find any reason why this would break anything.
The question is what our future plans with object coupling are. I think in general it would be desirable to avoid using global objects wherever possible, e.g. when using Kirby on the CLI with multiple independent app objects. But that's definitely a question for the future, we can still add the app objects as props back in later.
What we could also consider in the future is to implement custom serialization logic with the Serializable
interface. It really doesn't make much sense to serialize all property data with every object.
Not sure but I think also you need to check out following lines: (check |
…tkirby/kirby into fix/6061-serializable-objects
@afbora I found two more places where we pass kirby to the user models. |
@bastianallgeier Sorry, I just pointing what I found similar ones. Is this possible one? |
@afbora yep, we don't even use it in the role class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those changes all look safe to me as I can't find any place in our code that tries to access those kirby
props. Also can't find more places where we pass but don't use the kirby
prop. A few classes (Cms\Api
and Cms\Auth\Status
) actually rely on it, but those are commonly not serialized.
This PR …
With the refactoring of property setters in models in v4, Kirby got passed as an instance to
propertyData['kirby']
This broke serializing and could have other side effects. I wonder if some whoops issues are related to it as well.I've tracked down all the parts where we pass Kirby to a model. This should have no side-effects in theory. The models use static::$kirby as property and don't fetch the Kirby instance from the propertyData array anyway. But it remains a bit risk.
Fixes
Breaking changes
Ready?
For review team