diff --git a/plugins/Embed/Controller/OEmbed.php b/plugins/Embed/Controller/OEmbed.php index 326708ac95..d8a34fa340 100644 --- a/plugins/Embed/Controller/OEmbed.php +++ b/plugins/Embed/Controller/OEmbed.php @@ -51,7 +51,7 @@ class OEmbed extends Controller /** * Handle OEmbed server requests */ - protected function handle(Request $request) + public function handle(Request $request) { throw new NotImplementedException(); // $url = $this->trimmed('url'); diff --git a/src/Core/Controller.php b/src/Core/Controller.php index e460a4cc75..2b7f36b87c 100644 --- a/src/Core/Controller.php +++ b/src/Core/Controller.php @@ -81,9 +81,9 @@ abstract class Controller extends AbstractController implements EventSubscriberI */ public function __invoke(Request $request) { - $class = static::class; - $method = 'on' . ucfirst(mb_strtolower($request->getMethod())); - $attributes = array_diff_key($request->attributes->get('_route_params'), array_flip(['_format', '_fragment', '_locale', 'template', 'accept', 'is_system_path'])); + $class = static::class; + $method = 'on' . ucfirst(mb_strtolower($request->getMethod())); + $attributes = array_diff_key($request->attributes->get('_route_params'), array_flip(['_format', '_fragment', '_locale', 'template', 'accept', 'is_system_path'])); if (method_exists($class, $method)) { return $this->{$method}($request, ...$attributes); } @@ -91,6 +91,18 @@ abstract class Controller extends AbstractController implements EventSubscriberI return $this->handle($request, ...$attributes); } + public function handle(Request $request) + { + $class = static::class; + $method = 'on' . ucfirst(mb_strtolower($request->getMethod())); + if (method_exists($class, $method)) { + return $this->{$method}($request); + } + + $attributes = array_diff_key($request->attributes->get('_route_params'), array_flip(['_format', '_fragment', '_locale', 'template', 'accept', 'is_system_path'])); + return $this->handle($request, ...$attributes); + } + /** * Symfony event when it's searching for which controller to use */