zacksleo / yii-gitlab-error-behavior
yii2 error behavior for gitlab
Installs: 837
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii: ^1.1
README
gitlab error behavior for yii1
Usage
Install By Composer
composer require zacksleo/yii-gitlab-error-behavior --prefer-dist
set component
'errorHandler' => [
'errorAction' => 'site/error',
],
set behavior in SiteController
set apiRoot, privateToken and projectName
public function behaviors()
{
return array(
'error' => array(
'class' => 'webroot.vendor.zacksleo.yii-gitlab-error-behavior.src.ErrorBehavior',
'apiRoot' => 'http://gitlab.com/api/v3/',
'privateToken' => '{privateToken}',
'projectName' => '{demo/project}'
)
);
}
public function onBeforeAction($event)
{
$this->raiseEvent('onBeforeAction', $event);
}
public function actionError()
{
if ($error = Yii::app()->errorHandler->error) {
$this->onBeforeAction(new CEvent($this));
$this->renderPartial('error', $error);
}
}