Skip to content

Commit

Permalink
Merge pull request #16655 from alrieckert/5.0.x
Browse files Browse the repository at this point in the history
Include the reference model name in the build query when getting rela…
  • Loading branch information
niden authored Oct 21, 2024
2 parents 738cbdf + 446c8f4 commit d518c27
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions phalcon/Mvc/Model/Manager.zep
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d518c27

Please sign in to comment.