File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
main/java/fr/adrienbrault/idea/symfony2plugin/routing
test/java/fr/adrienbrault/idea/symfony2plugin/tests/routing Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -168,7 +168,20 @@ public static PsiElement[] getMethodsOnControllerShortcut(@NotNull Project proje
168168 String methodName = controllerName .substring (controllerName .lastIndexOf ("::" ) + 2 );
169169
170170 Method method = PhpElementsUtil .getClassMethod (project , className , methodName );
171- return method != null ? new PsiElement [] {method } : new PsiElement [0 ];
171+
172+ Collection <Method > methods = new HashSet <>();
173+ if (method != null ) {
174+ methods .add (method );
175+ }
176+
177+ if (!methodName .toLowerCase ().endsWith ("action" )) {
178+ Method methodAction = PhpElementsUtil .getClassMethod (project , className , methodName + "Action" );
179+ if (methodAction != null ) {
180+ methods .add (methodAction );
181+ }
182+ }
183+
184+ return methods .toArray (new PsiElement [0 ]);
172185
173186 } else if (controllerName .contains (":" )) {
174187 // AcmeDemoBundle:Demo:hello
Original file line number Diff line number Diff line change @@ -447,6 +447,7 @@ public void testGetMethodsOnControllerShortcutForControllerAsInvokeAction() {
447447 "{\n " +
448448 " public function __invoke() {}\n " +
449449 " public function barAction() {}\n " +
450+ " public function fooAction() {}\n " +
450451 "}\n "
451452 );
452453
@@ -458,6 +459,9 @@ public void testGetMethodsOnControllerShortcutForControllerAsInvokeAction() {
458459
459460 targets = RouteHelper .getMethodsOnControllerShortcut (getProject (), "Foobar\\ Bar::barAction" );
460461 assertEquals ("barAction" , ((Method ) targets [0 ]).getName ());
462+
463+ targets = RouteHelper .getMethodsOnControllerShortcut (getProject (), "Foobar\\ Bar::foo" );
464+ assertEquals ("fooAction" , ((Method ) targets [0 ]).getName ());
461465 }
462466
463467 /**
You can’t perform that action at this time.
0 commit comments