2017 © Pedro Peláez
 

yii2-extension yii2-crud-actions

Yii2 crud actions

image

andreykluev/yii2-crud-actions

Yii2 crud actions

  • Thursday, March 17, 2016
  • by AndreyKluev
  • Repository
  • 3 Watchers
  • 2 Stars
  • 247 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

CrudActions - CRUD actions extension for Yii

Установка

В composer.json:, (*1)

"require": {
    ...
    "andreykluev/yii2-crud-actions": "dev-master"
},

Варианты использования

``` php use andreykluev\crudactions\crudActionCreate; use andreykluev\crudactions\crudActionDelete; use andreykluev\crudactions\crudActionUpdate;, (*2)

use common\models\Product;, (*3)

class CatalogController extends AppController {, (*4)

...

public function actions()
{
    return array(
        'insert' => [
            'class' => crudActionCreate::className(),
            'model' => new Product(),
            'view' => 'update-album',
            'onBeforeAction' =>  [$this, 'beforeSaveProduct'],
            'onAfterAction' =>  [$this, 'afterSaveProduct'],
        ],

        'update' => [
            'class' => crudActionUpdate::className(),
            'modelClass' => Product::className(),
            'attributes' => [
                'id_user' => Yii::$app->user->identity->getId(),
                'id_album' => Yii::$app->request->get('idAlbum', 0),
            ],
            'view' => 'update-album',
            'onBeforeAction' =>  [$this, 'beforeSaveProduct'],
            'onAfterAction' =>  [$this, 'afterSaveProduct'],
        ],

        'delete' => [
            'class' => crudActionDelete::className(),
            'modelClass' => Product::className(),
            'onBeforeAction' =>  [$this, 'beforeDeleteProduct'],
            'onAfterAction' =>  [$this, 'afterDeleteProduct'],
        ],

        ...
    );
}

...

public function beforeSaveProduct()
{
    // Ваш код
}

public function afterSaveProduct($isSave = false)
{
    // Ваш код
}

public function beforeDeleteProduct()
{
    // Ваш код
}

public function afterDeleteProduct($isDelete = false)
{
    // Ваш код
}

```, (*5)

The Versions

17/03 2016

dev-master

9999999-dev

Yii2 crud actions

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

yii2 crud

01/04 2015

0.2

0.2.0.0

Yii2 crud actions

  Sources   Download

BSD-3-Clause

The Requires

 

yii2 crud