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
[POC] Support of modern controllers on module tabs #13889
[POC] Support of modern controllers on module tabs #13889
Conversation
* | ||
* @ToDo | ||
*/ | ||
// Legacy Tab, to be replaced with Doctrine entity when right management |
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.
maybe this comment/todo can be dropped now?
|
||
$className = $tabDetails->get('class_name'); | ||
|
||
if (is_subclass_of($className, FrameworkBundleAdminController::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.
What's the difference between this and
if ($className instanceof FrameworkBundleAdminController) {
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.
An example si better than a long story: https://www.php.net/manual/en/internals2.opcodes.instanceof.php#109108
But don't know why you use is_subclass_of
here 🤔
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 know the difference, my question was actually the same as yours. Is there a specific need here?
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.
if I remember well, instanceof
only accepts instances and not class names: if I'm wrong, I'm also in favor of using instanceof
instead.
instanceof est utilisé pour déterminer si une variable PHP est un objet instancié d'une certaine classe
$className = $tabDetails->get('class_name'); | ||
|
||
if (is_subclass_of($className, FrameworkBundleAdminController::class)) { | ||
$className = $tabDetails->get('legacy_class_name'); |
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.
thinking about it, it's a very naive implementation: I should check for the existence of this parameter and throw an exception with a meaningful message pointing to the docs: wdyt?
Closed in favor of #12640 |
Just noticed you have worked on #14679 👍 |
Yes, I was about to tell you but you found it :) |
ping @Quetzacoalt91 for review ;)
Use
This change is