mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 15:21:13 +08:00
Fixes #6678: yii\behaviors\SluggableBehavior
will generate a new slug only when the slug attribute is empty or the source attribute is changed
This commit is contained in:
@ -16,6 +16,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #6618: Added Model::addErrors() (slavcodev, pana1990)
|
- Enh #6618: Added Model::addErrors() (slavcodev, pana1990)
|
||||||
- Chg #6427: In case of invalid route web application now throws exception with "Page not found" instead of "Invalid Route" (cebe, samdark)
|
- Chg #6427: In case of invalid route web application now throws exception with "Page not found" instead of "Invalid Route" (cebe, samdark)
|
||||||
- Chg #6641: removed zero padding from ETag strings (DaSourcerer)
|
- Chg #6641: removed zero padding from ETag strings (DaSourcerer)
|
||||||
|
- Chg #6678: `yii\behaviors\SluggableBehavior` will generate a new slug only when the slug attribute is empty or the source attribute is changed (qiangxue)
|
||||||
|
|
||||||
2.0.1 December 07, 2014
|
2.0.1 December 07, 2014
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -137,7 +137,7 @@ class SluggableBehavior extends AttributeBehavior
|
|||||||
$attributes = (array) $this->attribute;
|
$attributes = (array) $this->attribute;
|
||||||
/* @var $owner BaseActiveRecord */
|
/* @var $owner BaseActiveRecord */
|
||||||
$owner = $this->owner;
|
$owner = $this->owner;
|
||||||
if (!$owner->getIsNewRecord() && !empty($owner->{$this->slugAttribute})) {
|
if (!empty($owner->{$this->slugAttribute})) {
|
||||||
$isNewSlug = false;
|
$isNewSlug = false;
|
||||||
if (!$this->immutable) {
|
if (!$this->immutable) {
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
|
Reference in New Issue
Block a user