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
Narrow Form and Mapper API #6267
Narrow Form and Mapper API #6267
Conversation
32d0283
to
c4145ef
Compare
3482023
to
e3328bc
Compare
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.
IMO, changelog messages should be focused in the namespaces instead of the directories where they are declared.
By instance:
Narrow the API for classes declared under the
Sonata\AdminBundle\Form\
namespace.
Could you please rebase your PR and fix merge conflicts? |
Done on all PRs |
e3328bc
to
bd85adf
Compare
By the way, I discovered this changelog file on master https://github.com/sonata-project/SonataAdminBundle/blob/master/CHANGELOG-4.0.md Should we do something about it ? |
Could you please rebase your PR and fix merge conflicts? |
IMO the initial release of SonataAdmin 4.0 (or alpha version) will need to redo that file and add the missing changelog lines. |
05d850f
to
0d94ee1
Compare
ee1c7de
to
8fb9201
Compare
This PRs needs to wait to the #6261 merge first. Then I will have to check if everything works, and update it. |
This one needs the #6261 first |
3f92df9
to
0278dae
Compare
0bb4b39
to
9d9b21a
Compare
Just found this: https://github.com/sonata-project/SonataDoctrineORMAdminBundle/blob/3.x/src/Builder/FormContractor.php#L104-L131 In theory that field should never be null really. It is a bit strange how everything around this modelType was implemented, but I prefer to fix the test rather than introduce a new else case on a code that shouldn't be reachable. Wdyt? |
* | ||
* @phpstan-param class-string $class | ||
* @phpstan-param class-string|null $class | ||
*/ | ||
public function __construct( |
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.
Upgrade note is needed
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.
Do you think this case is different from the rest of the code we changed? TBH using this modelType inside sonata can't lead to getting null here as 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.
The construct arguments changed.
Before new ModelChoiceLoader($modelManager, $class)
was ok.
Now it won't work.
Im sorry, I dont understand. |
And wdyt about this ? |
Yes, sorry I think my previous answer was not really complete.
Yes, It could work, but the thing is: ModelType does 3 https://github.com/sonata-project/SonataAdminBundle/blob/master/src/Form/Type/ModelType.php#L54 Those classes have the following https://github.com/sonata-project/SonataAdminBundle/blob/master/src/Form/DataTransformer/ModelsToArrayTransformer.php#L47 (this one is already typed: #5873) The last one is where we having this discussion about accepting or not null. Initially I thought that What really happens is if we want to be consistent with the For now, one could argue that those 3 classes could accept null because it can happen when creating that form field without giving the class option, but reading docs and code I found: reading below that...
And if we look at code on So, If one uses the ModelType on Sonata, with the persistence bundle (the only viable choice for this form type atm), that code will get executed and the Bonus points, if we consider that With all the information, my opinion is that:
|
1b78510
to
0fb5e7a
Compare
That's what I meant from the beginning, but well explained 🤣 |
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.
Since you're changing the ModelChoiceLoader required arguments (and the order) I think you need a Changelog. Everything else seems ok to me.
Please review @core23
Change requested was added more then one month ago. Also it is made now.
@jordisala1991 IMO this is RTM but will be nice to add changelog (like @VincentLanglet mentioned). |
Why can you dismiss the core23 review @wbloszyk ? Or how do you do ? 😅 |
Changelog is already added, can we have this one merged? |
In uprade is write about it. |
Thank you @jordisala1991 |
Subject
I am targeting this branch, because this is a BC break.
Changelog
I have applied PHPStan level 8 and Psalm level 2 when doing it and all of the errors related to the typehints are done.