-
-
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
Skip setting the parent when creating a new entity in a child admin #7548
Comments
Maybe @VincentLanglet can help. The method was introduced with this PR: #6171 |
I did introduce the method, but the logic was here for a long time. @goetas What about checking there is not already a value (and we can also check this is the expected value) before trying to set one. This way the setter is only called if you don't set the value in the createNewInstance. |
in 3.x we were overriding the
Do you mean to add more logic to |
Maybe moving the |
@VincentLanglet That would solve it for sure! And i think that your is a better solution than what I have proposed at the beginning (some config option). |
Can you open a PR ? My only concerned is that can be considered as a BC break... |
Sure, i will do it today.
That is true, but from a very strict point of view.... and sonate 4.x is very young :) |
see #7549 |
Feature Request
Hi, would you be interested in a PR that inhibits somehow sonata by setting the parent entity for an entity.
I'm referring more precisely to this piece of code.
SonataAdminBundle/src/Admin/AbstractAdmin.php
Line 2189 in 9669141
We try to avoid having setters in our entities and especially for parent identifiers we try to pass them in the constructor. We do so by overriding
createNewInstance
.Are you willing to accept a PR that allows to skip it? if yes, what it the recommended way? a protected method in the abstract admin? some property or what? (i think that it should be a per-admin setting, not a global one)
The text was updated successfully, but these errors were encountered: