-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support invokable controllers #51
Conversation
@rvanlaak please review |
composer.json
Outdated
"doctrine/annotations": "^v1.7", | ||
"doctrine/cache": "^v1.0", | ||
"symfony/twig-bundle": "^3.4|^4.0|^5.0", | ||
"symfony/browser-kit": "^3.4|^4.0|^5.0" |
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.
Is this dev requirement needed because of the tests? Can we prevent this from being added?
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.
Removed, not sure why I added it
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.
There's some Symfony dependency injection bug which prevents auto-wiring the FrameworkBundle in the older versions and I'm not sure when it was fixed. On the other hand, I'm not sure if I really need the framework bundle to run the tests
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.
Got around it by disabling autoconfigure and autowire in src/Resources/config/services.xml
@@ -48,7 +48,7 @@ public function __construct(Reader $reader, Trail $breadcrumbTrail) | |||
public function onKernelController(KernelEvent $event) | |||
{ | |||
if (!is_array($controller = $event->getController())) { | |||
return; | |||
$controller = [$controller, '__invoke']; |
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 if controller isn't an array, but is something different as a callable?
Would an early return in case it isn't callable make sense?
if (!is_callable($controller)) {
return;
}
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.
Both constructor and setter for both events have callable
type-hint for $controller
, so I guess there isn't any point in such a check
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 check wouldn't be needed for $controller
, but on the combination of [$controller, '__invoke']
as not every controller does implement that.
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.
Added more callable type checks for what can not be handled with Doctrine annotation reader along with this check
254a285
to
bb2f1e9
Compare
…% listener coverage
The |
@rvanlaak what do you think about changing the "suggests" as well? |
@kick-the-bucket can you rebase on |
Will do tomorrow
…On Mon 23 Nov 2020, 15:35 Richard van Laak, ***@***.***> wrote:
@kick-the-bucket <https://github.com/kick-the-bucket> can you rebase on
master?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#51 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABV5XNEFMTLMVO4OZBG2BFLSRJQKTANCNFSM4OJIA7RQ>
.
|
@kick-the-bucket thank you a lot for your PR, it was the inspiration for me in creating a simplified version in #71 Let me know what you think of the implementation! Will merge the other PR for now and close this PR, so we can soon release v1.7 that supports invokable controllers. |
Took some 16 months, but I guess better late, than never, right? 😅 |
Did release |
I have changed jobs and am no longer using this bundle. |
Currently
@Breadcrumb
annotations are not read from invokable Controllers: