-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Move getter from TaggedAdminInterface to AdminInterface #6713
Conversation
ce73390
to
d407edb
Compare
/** | ||
* @return array<string, array<string, mixed>> | ||
*/ | ||
public function getListModes(); |
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.
why this method should be in this interface? listModes
does not sound like should be in the tagged
part.
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.
It's tricky but it's related to the method showMosaicButton()
.
showMosaicButton
is kinda the setter of the property listModes
, and getListModes
the getter.
d407edb
to
3091807
Compare
Please review @sonata-project/contributors. I'd like to merge 3.x into master after this. Is it ok for you @franmomu ? |
/** | ||
* @return array<string, array<string, mixed>> | ||
*/ | ||
public function getListModes(); |
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.
Keep in mind, that this is a BC break.
The new interface is not released, so this is okay for now.
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.
Yeah, I take advantage of the fact it's not released :)
To be honest, I'm not sure, it feels like mixing things here. Reading #6614, if the idea of this interface is to add setters for what is configurable with In this particular case I guess that |
0544967
to
1c08c17
Compare
I added a commit. WDYT about it now ?
In the next major we could work on removing the fact that the AdminInterface extends the AdminTaggedInterface. |
The psalm error is weird:
to
|
e741383
to
baf97b3
Compare
I didn't solve this weird psalm issue, so I added |
72582cb
to
e919db5
Compare
I finally find out how to solve my issue @sonata-project/contributors cc @franmomu |
I don't think getters should be in |
That's why I first put the getters in the TaggedAdminInterface. I dont se any interest putting getters in AbstractAdmin and setters in AbstractTaggedAdmin. Having both in AbstractTaggedAdmin allows to restrict the visibility of the class property to private. It's true that to use the admin tag, only the setter are needed, so the interface should only have the setters. But our implementation can be provided with the getters too ; that's not forbidden. |
Can we finish this @franmomu (cc @sonata-project/contributors) Having both getter and setter in AbstractTaggedAdmin is easier in order to restrict the property visibility, which is something we want to do in the next Major. I think it's easier this way. Then, I would say we can
For a longer explanation from slack:
|
e919db5
to
34f10d6
Compare
Since @OskarStark agree with me on the option 3, I updated the PR. This just need your +1 @sonata-project/contributors ;) |
Why do we want to restrict the property visibility of these properties in the |
It's not the same.
|
What's preventing having getters and setters with type declaration? For the |
There was already a discussion about this.
|
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.
Looks good for me. IMO You should not add release version in this PR but do it in seperate dediated PR.
Why not? https://3v4l.org/pJV5D I'm not sure if these getters should be final, I was going to try to use a Service Locator to inject all these services and I have to override the getters in order to use the service locator. |
Didnt know it worked. The first time I used Trait, all I see on internet was that constructor in Trait should never be done because it was a bad practice. I think it's because Trait should be seen like helpers and should have nothing to do with the class instantiation ; and overriding a trait constructor is maybe difficult.
Firstly, I was following the whole "close API" strategy. Secondly, If the admin tag is provided, the setters will be called by the compiler pass, so properties will be set and I don't see why it would be needed to change the getters in this case. So final made sens to me. Can you develop your idea with service locators ? Does it mean you won't use the "admin" tag ? |
Subject
I am targeting this branch, because BC. Because the TaggedAdminInterface is not released.
After the merge, I will edit the previous changelog.
Moving
getListModes
toAbstractTaggedAdmin
is consistent with others changes and allow to restrict the visibility of thelistModes
property to private in nextMajor.I also
Changelog