diff --git a/sources/Application/TwigBase/Controller/Controller.php b/sources/Application/TwigBase/Controller/Controller.php index 7c27e0ab9f..8db17c1a96 100644 --- a/sources/Application/TwigBase/Controller/Controller.php +++ b/sources/Application/TwigBase/Controller/Controller.php @@ -204,15 +204,16 @@ abstract class Controller extends AbstractController $this->CheckAccess(); $this->m_sOperation = utils::ReadParam('operation', $this->m_sDefaultOperation); - $sMethodName = 'Operation'.utils::ToCamelCase($this->m_sOperation); - if (method_exists($this, $sMethodName)) - { - $this->$sMethodName(); + if ($this->CallOperation(utils::ToCamelCase($this->m_sOperation))) { + return; } - else - { - $this->DisplayPageNotFound(); + + // Fallback to unchanged names for compatibility + if ($this->CallOperation($this->m_sOperation)) { + return; } + + $this->DisplayPageNotFound(); } catch (Exception $e) { @@ -222,6 +223,17 @@ abstract class Controller extends AbstractController } } + private function CallOperation($sOperation): bool + { + $sMethodName = 'Operation'.$sOperation; + if (!method_exists($this, $sMethodName)) { + return false; + } + + $this->$sMethodName(); + return true; + } + /** * Overridable "page not found" which is more an "operation not found" */