lagman/yii-crud

Yii CRUD utilities

dev-master 2014-08-28 06:13 UTC

This package is auto-updated.

Last update: 2024-12-17 20:03:16 UTC


README

Usage examples

class NewsController extends CController
{
    public $className = 'News';

    public function actions()
    {
        return [
            'create' => [
                'class' => 'vendor.lagman.yii-crud.CreateAction',
                'modelClass' => $this->className,
                'redirectHandler' => function(CActiveRecord $model) {
                    $this->redirect(['view', 'id' => $model->primaryKey]);
                },
            ],
            'update' => [
                'class' => 'vendor.lagman.yii-crud.UpdateAction',
                'modelClass' => $this->className,
                'redirectHandler' => function(CActiveRecord $model) {
                    $this->redirect(['view', 'id' => $model->primaryKey]);
                },
            ],
            'delete' => [
                'class' => 'vendor.lagman.yii-crud.DeleteAction',
                'modelClass' => $this->className,
            ],
            'view' => [
                'class' => 'vendor.lagman.yii-crud.ViewAction',
                'modelClass' => $this->className,
            ],
            'index' => [
                'class' => 'vendor.lagman.yii-crud.IndexAction',
                'modelClass' => $this->className,
            ],
        ];
    }
}