Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deep associations are not handled properly in queries #18929

@nicosp

Description

@nicosp

Description

Consider this:

  • UsersTable->belongsTo('Contacts')
  • ArticlesTable->belongsTo('Creator')->setClassName('Users')
  • ArticleTable->belongsTo('Modifier')->setClassName('Users')

If we include Creator.Contacts and Modifier.Contacts in the same query the Contacts table will be joined once with the "Contacts" alias.

ie. the join is generated as JOIN contacts Contacts instead of Creator_Contacts or something like that.

Ideally the proper joins should be generated to support this, or at least only match one of the two associations in the resulting data.

CakePHP Version

5.2

PHP Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions