mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
Fix #18634: Fix yii\db\BaseActiveRecord::unlink() and unlinkAll() to omit condition for on property when it doesn't exist
This commit is contained in:
@ -1,10 +1,10 @@
|
|||||||
Yii Framework 2 Change Log
|
Yii Framework 2 Change Log
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
2.0.43 under development
|
2.0.42.1 under development
|
||||||
------------------------
|
--------------------------
|
||||||
|
|
||||||
- no changes in this release.
|
- Bug #18634: Fix `yii\db\BaseActiveRecord::unlink()` and `unlinkAll()` to omit condition for `on` property when it doesn't exist (bizley)
|
||||||
|
|
||||||
|
|
||||||
2.0.42 May 05, 2021
|
2.0.42 May 05, 2021
|
||||||
|
|||||||
@ -1413,7 +1413,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
|||||||
foreach (array_keys($columns) as $a) {
|
foreach (array_keys($columns) as $a) {
|
||||||
$nulls[$a] = null;
|
$nulls[$a] = null;
|
||||||
}
|
}
|
||||||
if ($viaRelation->on !== null) {
|
if (property_exists($viaRelation, 'on') && $viaRelation->on !== null) {
|
||||||
$columns = ['and', $columns, $viaRelation->on];
|
$columns = ['and', $columns, $viaRelation->on];
|
||||||
}
|
}
|
||||||
if (is_array($relation->via)) {
|
if (is_array($relation->via)) {
|
||||||
@ -1513,7 +1513,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
|||||||
if (!empty($viaRelation->where)) {
|
if (!empty($viaRelation->where)) {
|
||||||
$condition = ['and', $condition, $viaRelation->where];
|
$condition = ['and', $condition, $viaRelation->where];
|
||||||
}
|
}
|
||||||
if (!empty($viaRelation->on)) {
|
if (property_exists($viaRelation, 'on') && !empty($viaRelation->on)) {
|
||||||
$condition = ['and', $condition, $viaRelation->on];
|
$condition = ['and', $condition, $viaRelation->on];
|
||||||
}
|
}
|
||||||
if (is_array($relation->via)) {
|
if (is_array($relation->via)) {
|
||||||
@ -1550,7 +1550,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
|
|||||||
if (!empty($relation->where)) {
|
if (!empty($relation->where)) {
|
||||||
$condition = ['and', $condition, $relation->where];
|
$condition = ['and', $condition, $relation->where];
|
||||||
}
|
}
|
||||||
if (!empty($relation->on)) {
|
if (property_exists($relation, 'on') && !empty($relation->on)) {
|
||||||
$condition = ['and', $condition, $relation->on];
|
$condition = ['and', $condition, $relation->on];
|
||||||
}
|
}
|
||||||
if ($delete) {
|
if ($delete) {
|
||||||
|
|||||||
Reference in New Issue
Block a user