dev-master
9999999-devYii2 crud actions
BSD-3-Clause
The Requires
The Development Requires
yii2 crud
0.2
0.2.0.0Yii2 crud actions
BSD-3-Clause
The Requires
yii2 crud
Yii2 crud actions
В 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)
Yii2 crud actions
BSD-3-Clause
yii2 crud
Yii2 crud actions
BSD-3-Clause
yii2 crud