Skip to content

Conversation

@themasch
Copy link

@themasch themasch commented Feb 22, 2024

In 2.17 EAGER fetched OneToMany associations stopped working, if they have multiple join columns due to #8391.

Loads for these associations will trigger a MessingPositionalParameter exception "Positional parameter at index 1 does not have a bound value".

This test case should reproduce this issue (#11154), so it can be fixed.

The PR changes eager loading for target associations with composite identifier not to use batch loading anymore, falling back to the original behavior before #8391. It also cleans up the conditions here after they were made more complex than necessary with #11082

Related:

Fixes #11154

After 2.17 (some?) EAGER fetched OneToMany associations stopped working, if they have multiple join columns. Loads for these associations will trigger a `MessingPositionalParameter` exception "Positional parameter at index 1 does not have a bound value".

This test case should reproduce this issue, so it can be fixed.
@beberlei beberlei changed the title provides a test case for #11154 Do not use batch loading for collections with composite identifier Mar 16, 2024
beberlei
beberlei previously approved these changes Mar 16, 2024
Copy link
Member

@beberlei beberlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug is valid, introduced a fix and updated the PR title and description with details.

@beberlei beberlei changed the base branch from 2.18.x to 2.19.x March 16, 2024 22:10
@beberlei beberlei dismissed their stale review March 16, 2024 22:10

The base branch was changed.

beberlei
beberlei previously approved these changes Mar 16, 2024
@greg0ire greg0ire added this to the 2.19.2 milestone Mar 18, 2024
@greg0ire greg0ire merged commit 40a0964 into doctrine:2.19.x Mar 18, 2024
@greg0ire
Copy link
Member

Thanks @themasch @beberlei !

greg0ire pushed a commit that referenced this pull request Nov 18, 2025
I think #11289 did not completely fix problem for eager fetch.
Change in that PR checked if primary key of target class is composite but that does not matter when loading collection by foreign key.
It should check if foreign key on target class is composite.

Fix from that PR did not work for me because i had entity with regular autogenerated id (single column), but foreign key referenced entity with composite primary key, like SecondLevelWithoutCompositePrimaryKey in this PR.

Checking if foreign key is composite fixed the problem for me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants