diff --git a/CHANGELOG-5.0.md b/CHANGELOG-5.0.md index 39ef82cbe0..e9fd9e77f6 100644 --- a/CHANGELOG-5.0.md +++ b/CHANGELOG-5.0.md @@ -13,6 +13,7 @@ - Fixed `Phalcon\Encryption\Crypt` to use `strlen` instead of `mb_strlen` for padding calculations [#16642](https://github.com/phalcon/cphalcon/issues/16642) - Fixed `Phalcon\Filter\Validation\Validator\File\MimeType::validate` to close the handle when using `finfo` [#16647](https://github.com/phalcon/cphalcon/issues/16647) +- Fixed `Phalcon\Mvc\Model\Manager::getRelationRecords` to explicitly set the `referencedModel` in the conditions along with the `referencedFields` [#16655](https://github.com/phalcon/cphalcon/pull/16655) - Fixed `Phalcon\Image\Adapters\AbstractAdapter::watermark` to correctly calculate the Y offset [#16658](https://github.com/phalcon/cphalcon/issues/16658) ### Removed diff --git a/phalcon/Mvc/Model/Manager.zep b/phalcon/Mvc/Model/Manager.zep index 98dd401e0d..3112b0d5ee 100644 --- a/phalcon/Mvc/Model/Manager.zep +++ b/phalcon/Mvc/Model/Manager.zep @@ -1460,11 +1460,11 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI let referencedFields = relation->getReferencedFields(); if typeof fields != "array" { - let conditions[] = "[". referencedFields . "] = :APR0:", + let conditions[] = "[" . referencedModel . "].[". referencedFields . "] = :APR0:", placeholders["APR0"] = record->readAttribute(fields); } else { for refPosition, field in relation->getFields() { - let conditions[] = "[". referencedFields[refPosition] . "] = :APR" . refPosition . ":", + let conditions[] = "[" . referencedModel . "].[". referencedFields[refPosition] . "] = :APR" . refPosition . ":", placeholders["APR" . refPosition] = record->readAttribute(field); } }