Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return [TimestampBehavior::className(), ['class' => Slug::className(), 'attribute' => 'username', 'immutable' => false]];
 }
Esempio n. 2
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return ['slug' => ['class' => Slug::className(), 'attribute' => ['name']]];
 }
Esempio n. 3
-1
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     $parent = parent::behaviors();
     if (!empty($this->generateFrom) and $this->model->scenario != ActiveRecord::SCENARIO_SEARCH) {
         $code = self::BEHAVIOR_PREF . ucfirst($this->attr);
         $parent[$code] = ArrayHelper::merge(['class' => \Zelenin\yii\behaviors\Slug::className(), 'slugAttribute' => $this->attr, 'attribute' => $this->generateFrom, 'ensureUnique' => true, 'translit' => true, 'replacement' => '-', 'lowercase' => true, 'immutable' => true, 'uniqueValidator' => array_merge(['class' => $this->uniqueValidatorClassName], $this->uniqueParams), 'transliterateOptions' => 'Russian-Latin/BGN;'], $this->slugOptions);
     }
     return $parent;
 }