@@ -282,7 +282,12 @@ private function route(string $route, array $params): array
282
282
*/
283
283
private function invokeActionMethod (Endpoint $ endpoint , string $ action , string $ method , array $ params ): ?BaseResponse
284
284
{
285
- $ methodName = $ this ->getActionMethodName ($ endpoint , $ method , $ action );
285
+ if (($ methodName = $ this ->getActionMethodName ($ endpoint , $ method , $ action )) === null ) {
286
+ return new JsonResponse ($ this ->convention , [
287
+ 'state ' => 'error ' ,
288
+ 'message ' => 'Method for action " ' . $ action . '" and HTTP method " ' . $ method . '" is not implemented. ' ,
289
+ ], 404 );
290
+ }
286
291
287
292
try {
288
293
if ($ this ->checkPermission ($ endpoint , $ methodName ) === false ) { // Forbidden or permission denied
@@ -303,14 +308,12 @@ private function invokeActionMethod(Endpoint $endpoint, string $action, string $
303
308
$ ref = null ;
304
309
$ response = null ;
305
310
306
- if ($ methodName !== null ) {
307
- try {
308
- $ response = (new ServiceMethodInvoker )->invoke ($ endpoint , $ methodName , $ params , true );
309
- } catch (ThrowResponse $ e ) {
310
- $ response = $ e ->getResponse ();
311
- } catch (RuntimeInvokeException $ e ) {
312
- throw new RuntimeStructuredApiException ($ e ->getMessage (), $ e ->getCode (), $ e );
313
- }
311
+ try {
312
+ $ response = (new ServiceMethodInvoker )->invoke ($ endpoint , $ methodName , $ params , true );
313
+ } catch (ThrowResponse $ e ) {
314
+ $ response = $ e ->getResponse ();
315
+ } catch (RuntimeInvokeException $ e ) {
316
+ throw new RuntimeStructuredApiException ($ e ->getMessage (), $ e ->getCode (), $ e );
314
317
}
315
318
316
319
if ($ method !== 'GET ' && $ response === null ) {
0 commit comments