[PR #846] joinColumn is not required in manyToMany #8793

Open
opened 2026-01-22 16:01:44 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/846

State: closed
Merged: No


in annotation you can don't write columns names:

/**
 * @ManyToMany(targetEntity="Group", inversedBy="users")
 * @JoinTable(name="users_groups")
 */

but in yaml you should:

manyToMany:
    groups:
        targetEntity: Group
        inversedBy: users
        joinTable:
            name: users_groups
        joinColumns:
            user_id:
            referencedColumnName: id
        inverseJoinColumns:
            group_id:
            referencedColumnName: id

this patch fixes this unexpected behavior

**Original Pull Request:** https://github.com/doctrine/orm/pull/846 **State:** closed **Merged:** No --- in annotation you can don't write columns names: ``` /** * @ManyToMany(targetEntity="Group", inversedBy="users") * @JoinTable(name="users_groups") */ ``` but in yaml you should: ``` manyToMany: groups: targetEntity: Group inversedBy: users joinTable: name: users_groups joinColumns: user_id: referencedColumnName: id inverseJoinColumns: group_id: referencedColumnName: id ``` this patch fixes this unexpected behavior
admin added the pull-request label 2026-01-22 16:01:44 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#8793