DDC-474: Confusing examples for @ManyToMany in Annotations Reference #592

Closed
opened 2026-01-22 12:43:35 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 25, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @hobodave:

See: http://www.doctrine-project.org/documentation/manual/2_0/en/annotations-reference#reference:@manytomany

/****
 * Owning Side
 *
 * @ManyToMany(targetEntity="Group")
 * @JoinTable(name="user_groups",
 *      joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")},
 *      inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")}
 *      )
 */
private $phonenumbers;

/****
 * Inverse Side
 *
 * @ManyToMany(targetEntity="Feature", mappedBy="product")
 */
private $features;

Phonenumbers has an M:N relationship with Group through user_groups table, huh? The inverse of this is Products to Feature?

Originally created by @doctrinebot on GitHub (Mar 25, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @hobodave: See: http://www.doctrine-project.org/documentation/manual/2_0/en/annotations-reference#reference:@manytomany ``` /**** * Owning Side * * @ManyToMany(targetEntity="Group") * @JoinTable(name="user_groups", * joinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@JoinColumn(name="group_id", referencedColumnName="id")} * ) */ private $phonenumbers; /**** * Inverse Side * * @ManyToMany(targetEntity="Feature", mappedBy="product") */ private $features; ``` Phonenumbers has an M:N relationship with Group through user_groups table, huh? The inverse of this is Products to Feature?
admin added the Improvement label 2026-01-22 12:43:35 +01:00
admin closed this issue 2026-01-22 12:43:35 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 25, 2010):

Comment created by @beberlei:

I must have been on crack while copy-pasting this together ;-)

@doctrinebot commented on GitHub (Mar 25, 2010): Comment created by @beberlei: I must have been on crack while copy-pasting this together ;-)
Author
Owner

@doctrinebot commented on GitHub (Mar 26, 2010):

Comment created by @beberlei:

Fixed, manual will auto-update in the next 24 hours

@doctrinebot commented on GitHub (Mar 26, 2010): Comment created by @beberlei: Fixed, manual will auto-update in the next 24 hours
Author
Owner

@doctrinebot commented on GitHub (Mar 26, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 26, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#592