<commit_before># CrudActions - CRUD actions extension for Yii #

## Установка ##

В composer.json:

```
"repositories": [
	{
		"type": "vcs",
		"url": "https://github.com/AndreyKluev/yii2-crud-actions.git"
	}
],
"require": {
	...
	"andreykluev/yii2-crud-actions":"dev-master"
},
```

## Использование ##

``` php
use andreykluev\crudactions\crudActionCreate;
use andreykluev\crudactions\crudActionDelete;
use andreykluev\crudactions\crudActionUpdate;

use common\models\Album;

class CatalogController extends AppController
{

	...

	public function actions()
	{
		return array(
			'insert-album' => [
				'class' => crudActionCreate::className(),
				'modelClass' => Album::className(),
				'view' => 'update-album',
				'onBeforeAction' =>  [$this, 'beforeSaveAlbum'],
				'onAfterAction' =>  [$this, 'afterSaveAlbum'],
			],
			
			'update-album' => [
				'class' => crudActionUpdate::className(),
				'modelClass' => Album::className(),
				'view' => 'update-album',
				'onBeforeAction' =>  [$this, 'beforeSaveAlbum'],
				'onAfterAction' =>  [$this, 'afterSaveAlbum'],
			],
			
			'delete-album' => [
				'class' => crudActionDelete::className(),
				'modelClass' => Album::className(),
				'onBeforeAction' =>  [$this, 'beforeDeleteAlbum'],
				'onAfterAction' =>  [$this, 'afterDeleteAlbum'],
			],

			...
		);
	}

	...
	
	public function beforeSaveAlbum()
	{
		// Ваш код
	}
	
	public function afterSaveAlbum($isSave = false)
	{
		// Ваш код
	}
	
	public function beforeDeleteAlbum()
	{
		// Ваш код
	}
	
	public function afterDeleteAlbum($isDelete = false)
	{
		// Ваш код<commit_msg>Более понятный README<commit_after># CrudActions - CRUD actions extension for Yii #

## Установка ##

В composer.json:

```
"repositories": [
	{
		"type": "vcs",
		"url": "https://github.com/AndreyKluev/yii2-crud-actions.git"
	}
],
"require": {
	...
	"andreykluev/yii2-crud-actions":"dev-master"
},
```

## Использование ##

``` php
use andreykluev\crudactions\crudActionCreate;
use andreykluev\crudactions\crudActionDelete;
use andreykluev\crudactions\crudActionUpdate;

use common\models\Product;

class CatalogController extends AppController
{

	...

	public function actions()
	{
		return array(
			'insert' => [
				'class' => crudActionCreate::className(),
				'modelClass' => Product::className(),
				'view' => 'update-album',
				'onBeforeAction' =>  [$this, 'beforeSaveProduct'],
				'onAfterAction' =>  [$this, 'afterSaveProduct'],
			],
			
			'update' => [
				'class' => crudActionUpdate::className(),
				'modelClass' => Product::className(),
				'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)
	{
		// Ваш код
{'fraction_non_alphanumeric': 0.1778816199376947, 'fraction_numerical': 0.0012461059190031153, 'mean_word_length': 3.6401734104046244, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 37, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4054454', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1131, 'n_words': 191}