mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 19:48:49 +02:00
N°2060 [WIP] Initialisation of the portal application: Refactor way brick controllers forward actions between each others
This commit is contained in:
@@ -382,7 +382,7 @@ class ObjectController extends BrickController
|
||||
'sObjectClass' => get_class($oTargetObject),
|
||||
);
|
||||
|
||||
return $this->forward($this->GetControllerNameFromRoute('p_object_create'), $aRouteParams, $oRequest->query->all());
|
||||
return $this->ForwardFromRoute('p_object_create', $aRouteParams, $oRequest->query->all());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1390,21 +1390,4 @@ class ObjectController extends BrickController
|
||||
|
||||
return $aObjectData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string containing the controller and action name of a specific route, typically used for request forwarding.
|
||||
*
|
||||
* Example: 'p_object_create' returns 'Combodo\iTop\Portal\Controller\ObjectController::CreateAction'
|
||||
*
|
||||
* @param string $sRouteName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function GetControllerNameFromRoute($sRouteName)
|
||||
{
|
||||
$oRouteCollection = $this->get('router')->getRouteCollection();
|
||||
$aRouteDefaults = $oRouteCollection->get($sRouteName)->getDefaults();
|
||||
|
||||
return $aRouteDefaults['_controller'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user