-
-
Notifications
You must be signed in to change notification settings - Fork 833
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
add a way to filter areas on route by annotation #1460
Conversation
0b55130
to
e33a732
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.
That's great, thanks!
I left a few comments :)
Annotation/Areas.php
Outdated
public function __construct(array $properties) | ||
{ | ||
if (!array_key_exists('value', $properties) || !is_array($properties['value'])) { | ||
throw new \InvalidArgumentException('An array of areas were expected'); |
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.
was
?
} | ||
|
||
try { | ||
$method = $this->routeReflector->controllerReflectionMethod($route); |
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.
I don't think this is a worth an util class, could we inline it please ?
->addArgument($areaConfig), | ||
->setArguments( | ||
[ | ||
new Reference('annotations.cached_reader'), |
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.
annotation_reader
instead, caching is managed by symfony
e33a732
to
dcfa5e2
Compare
I fixed everything according to your comments. |
Thank you @babaorum! |
Thanks @babaorum Worked like a charm, but had to use it with double quotes instead of single ones (as explained in https://stackoverflow.com/questions/6338178/troubleshooting-syntax-error-expected-plainvalue-got):
|
Fix #1246
Description
A new boolean configuration is available in the areas:
with_annotation
.By setting it to true, every route will be filtered by annotation.
Every route to match will need to add the
@Areas
with the area name.Example
the
default
area would only match the testAction(), while thearea2
will match both.