pesto/yii2-path-behavior

Automatic generation url path for the model while saving model/

0.1.0 2016-04-01 10:56 UTC

This package is not auto-updated.

Last update: 2024-05-03 16:56:47 UTC


README

Behavior для генерации URL адреса модели при сохранении.

Install

Выполните команду

$ php composer.phar require pesto/yii2-path-behavior "*"

или добавьте

"pesto/yii2-path-behavior": "*"

в секцию require вашего composer.json файла.

Usage

Теперь можно в методе behaviors() модели указать:

  public function behaviors()
  {
      return [
          ...
          [
              'class' => PathBehavior::className(),
              'fieldName' => 'path',          //Поле для генерации пути
              'fromFieldName' => 'title'      //Поле, за основу которого берется строка
          ]
          ...
      ];
  }