diff --git a/CHANGELOG-4.0.md b/CHANGELOG-4.0.md index 244e88adcee..585759317dd 100644 --- a/CHANGELOG-4.0.md +++ b/CHANGELOG-4.0.md @@ -34,6 +34,7 @@ - Fixed `Phalcon\Mvc\Model` to include correct model instances in messages metadata [#14510](https://github.com/phalcon/cphalcon/pull/14502) - Fixed `Phalcon\Di\Injectable::__get()` to return shared instance by default [#14491](https://github.com/phalcon/cphalcon/issues/14491) - Fixed `Phalcon\Mvc\View::loadTemplateEngines()` to not share engine with other views by default [#14491](https://github.com/phalcon/cphalcon/issues/14491) +- Fixed `Phalcon\Mvc\Model\Manager::getRelations()` and `getRelationsBetween()` to return many-to-many relations correctly [#14509](https://github.com/phalcon/cphalcon/pull/14509) ## Removed diff --git a/phalcon/Mvc/Model/Manager.zep b/phalcon/Mvc/Model/Manager.zep index 83d7a51d1f1..b5977b557c5 100644 --- a/phalcon/Mvc/Model/Manager.zep +++ b/phalcon/Mvc/Model/Manager.zep @@ -1860,7 +1860,7 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI /** * Get many-to-many relations */ - if fetch relations, this->hasManyToMany[entityName] { + if fetch relations, this->hasManyToManySingle[entityName] { for relation in relations { let allRelations[] = relation; } @@ -1907,6 +1907,13 @@ class Manager implements ManagerInterface, InjectionAwareInterface, EventsAwareI return relations; } + /** + * Check whether it's a has-many-to-many relationship + */ + if fetch relations, this->hasManyToMany[keyRelation] { + return relations; + } + return false; }