Skip to content

Instantly share code, notes, and snippets.

@Tobur
Created April 4, 2018 08:47
Show Gist options
  • Save Tobur/7e9cfcfaf98756e5f3b5da796c103f05 to your computer and use it in GitHub Desktop.
Save Tobur/7e9cfcfaf98756e5f3b5da796c103f05 to your computer and use it in GitHub Desktop.
/**
* @TODO find out yii 1 way to split extion per request method
*
* @throws CException
*/
public function actionIndex()
{
$request = $this->getRequest();
if ($request->getIsPostRequest()) {
$this->update();
return;
}
if ('GET' === $request->getRequestType()) {
$this->view();
return;
}
$this->throwErrorException(
'Unable to find action. Able only get and post!',
HttpCodeHelper::FORBIDDEN
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment