Jaxel
Well-known member
In my mods, I slug the minorSection string into an array and reroute my page into specific functions...
Right now its done as follows:
This works GREAT for me... however, I am a stickler for consistency and efficiency. In a previous thread, Mike told me that running a responseReroute will built a whole new controller object. This seems very inefficient to me...
Theoretically, I think I could just do the following instead:
Would there be a downside to handling it this way? It should be more efficient shouldn't it? Since it doesn't rebuild a new controller object?
Right now its done as follows:
Code:
public function actionIndex()
{
switch ($this->slugs[0])
{
case "modules": return $this->responseReroute(__CLASS__, 'Modules'); break;
case "update": return $this->responseReroute(__CLASS__, 'Update'); break;
case "edit": return $this->responseReroute(__CLASS__, 'Edit'); break;
case "save": return $this->responseReroute(__CLASS__, 'Save'); break;
case "import": return $this->responseReroute(__CLASS__, 'Import'); break;
case "export": return $this->responseReroute(__CLASS__, 'Export'); break;
case "delete": return $this->responseReroute(__CLASS__, 'Delete'); break;
}
return $this->responseReroute(__CLASS__, 'Portal');
}
This works GREAT for me... however, I am a stickler for consistency and efficiency. In a previous thread, Mike told me that running a responseReroute will built a whole new controller object. This seems very inefficient to me...
Theoretically, I think I could just do the following instead:
Code:
public function actionIndex()
{
switch ($this->slugs[0])
{
case "modules": return $this->actionModules(); break;
case "update": return $this->actionUpdate(); break;
case "edit": return $this->actionEdit(); break;
case "save": return $this->actionSave(); break;
case "import": return $this->actionImport(); break;
case "export": return $this->actionExport(); break;
case "delete": return $this->actionDelete(); break;
}
return $this->actionPortal();
}
Would there be a downside to handling it this way? It should be more efficient shouldn't it? Since it doesn't rebuild a new controller object?