Commit c072cc2e by Klimov Paul

`yii\behaviors\Sluggable` adjusted

parent ce183732
...@@ -136,11 +136,7 @@ class SluggableBehavior extends AttributeBehavior ...@@ -136,11 +136,7 @@ class SluggableBehavior extends AttributeBehavior
$isNewSlug = true; $isNewSlug = true;
if ($this->attribute !== null) { if ($this->attribute !== null) {
if (is_array($this->attribute)) { $attributes = (array)$this->attribute;
$attributes = $this->attribute;
} else {
$attributes = [$this->attribute];
}
/* @var $owner BaseActiveRecord */ /* @var $owner BaseActiveRecord */
$owner = $this->owner; $owner = $this->owner;
if (!$owner->getIsNewRecord() && !empty($owner->{$this->slugAttribute})) { if (!$owner->getIsNewRecord() && !empty($owner->{$this->slugAttribute})) {
...@@ -205,7 +201,7 @@ class SluggableBehavior extends AttributeBehavior ...@@ -205,7 +201,7 @@ class SluggableBehavior extends AttributeBehavior
* Generates slug using configured callback or increment of iteration. * Generates slug using configured callback or increment of iteration.
* @param string $baseSlug base slug value * @param string $baseSlug base slug value
* @param integer $iteration iteration number * @param integer $iteration iteration number
* @return string slug suffix * @return string new slug value
* @throws \yii\base\InvalidConfigException * @throws \yii\base\InvalidConfigException
*/ */
private function generateUniqueSlug($baseSlug, $iteration) private function generateUniqueSlug($baseSlug, $iteration)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment