Skip to content

Commit acebe18

Browse files
committed
filter methods in controller service related files #428
1 parent d8da126 commit acebe18

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/fr/adrienbrault/idea/symfony2plugin/routing/dic/ServiceRouteContainer.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,24 @@ public Collection<Route> getMethodMatches(Method method) {
6868
continue;
6969
}
7070

71+
// if controller matches:
72+
// service_id:methodName
7173
String[] split = serviceRoute.split(":");
72-
if(split.length != 2) {
74+
if(split.length != 2 || !split[1].equals(method.getName())) {
7375
continue;
7476
}
7577

78+
// cache PhpClass resolve
7679
if(!serviceCache.containsKey(split[0])) {
7780
serviceCache.put(split[0], ServiceUtil.getResolvedClassDefinition(method.getProject(), split[0], getLazyServiceCollector(method.getProject())));
7881
}
7982

8083
PhpClass phpClass = serviceCache.get(split[0]);
8184
if(phpClass != null && classFqn.equals(phpClass.getPresentableFQN())) {
82-
routes.add(route);
85+
Method targetMethod = phpClass.findMethodByName(split[1]);
86+
if(targetMethod != null) {
87+
routes.add(route);
88+
}
8389
}
8490
}
8591

0 commit comments

Comments
 (0)