mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 20:19:42 +08:00
Fix #19469: Fix a virtual relation not working because of new isset checks in \yii\db\ActiveRelationTrait
This commit is contained in:
@ -4,6 +4,7 @@ Yii Framework 2 Change Log
|
||||
2.0.46 under development
|
||||
------------------------
|
||||
|
||||
- Bug #19469: Fix a virtual relation not working because of new isset checks in `\yii\db\ActiveRelationTrait` (wvanheumen)
|
||||
- Bug #19380: Fix PHP 8.1 passing non string to trim() in `yii\db\Query` (wa1kb0y)
|
||||
- Bug #19272: Fix bug in dirty attributes check on multidimensional array (speedplli)
|
||||
- Bug #19349: Fix PHP 8.1 error when attribute and label of `yii\grid\DataColumn` are empty (githubjeka)
|
||||
|
||||
@ -528,7 +528,7 @@ trait ActiveRelationTrait
|
||||
// single key
|
||||
$attribute = reset($this->link);
|
||||
foreach ($models as $model) {
|
||||
$value = isset($model[$attribute]) ? $model[$attribute] : null;
|
||||
$value = isset($model[$attribute]) || (is_object($model) && property_exists($model, $attribute)) ? $model[$attribute] : null;
|
||||
if ($value !== null) {
|
||||
if (is_array($value)) {
|
||||
$values = array_merge($values, $value);
|
||||
@ -586,7 +586,7 @@ trait ActiveRelationTrait
|
||||
{
|
||||
$key = [];
|
||||
foreach ($attributes as $attribute) {
|
||||
if (isset($model[$attribute])) {
|
||||
if (isset($model[$attribute]) || (is_object($model) && property_exists($model, $attribute))) {
|
||||
$key[] = $this->normalizeModelKey($model[$attribute]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user