yii2
yii2 copied to clipboard
Update ActiveRelationTrait.php
fix #19507
Q | A |
---|---|
Is bugfix? | ✔️ |
New feature? | ❌ |
Breaks BC? | ❌ |
Fixed issues | #19507 |
Thank you for putting effort in the improvement of the Yii framework. We have reviewed your pull request.
In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests.
Could you add these please?
Thanks!
P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests
This is an automated comment, triggered by adding the label pr:request for unit tests
.
Just waiting for some other team member to approve it and we are good to go.
В db/ActiveRelationTrait.php, по-моему, есть баг.
Делаю запрос:
->joinWith([
'dayRealTime',
'user.usersWorkRoles.workRole.predictionType',
])
Получаю ошибку:
Undefined index: date
в функции filterByModels($models). date - это поле для связи по свойству dayRealTime.
Если добавить проверку на наличие элемента в массиве, то ошибка уходит:
foreach ($prefixedLink as $attribute => $link) {
$value = isset($model[$attribute]) || (is_object($model) && property_exists($model, $attribute)) ? $model[$attribute] : null;
if ($value !== null) {
$v[$attribute] = $model[$link];
}
}
@sigaryov it's better to create a separate issue for it. @arogachev would you please take a look?
@samdark. OK. I'll check it.
@sigaryov Thanks for reporting. Could you share the relevant data structure (you can remove sensitive data)?