DDC-1646: JoinColumn not working for associations throught another associations #2067

Open
opened 2026-01-22 13:39:26 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 10, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user alexeyshockov:

I have two objects: Sale and Blank. This two object doesn't associated directly, but association may be established using promoter_id and date database columns. But, when I wrote above code in Sale class:

@ORM\ManyToMany(targetEntity="Blank")
@ORM\JoinTable(
    name="blank",
    joinColumns={
        @ORM\JoinColumn(name="promoter*id", referencedColumnName="promoter*id"),
        @ORM\JoinColumn(name="date", referencedColumnName="date")
    },
    inverseJoinColumns={
        @ORM\JoinColumn(name="promoter*id", referencedColumnName="promoter*id"),
        @ORM\JoinColumn(name="date", referencedColumnName="date")
    }
)

I got error: "The column promoter_id must be mapped to a field in class Sale since it is referenced by a join column of another class".

Originally created by @doctrinebot on GitHub (Feb 10, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user alexeyshockov: I have two objects: Sale and Blank. This two object doesn't associated directly, but association may be established using promoter_id and date database columns. But, when I wrote above code in Sale class: ``` @ORM\ManyToMany(targetEntity="Blank") @ORM\JoinTable( name="blank", joinColumns={ @ORM\JoinColumn(name="promoter*id", referencedColumnName="promoter*id"), @ORM\JoinColumn(name="date", referencedColumnName="date") }, inverseJoinColumns={ @ORM\JoinColumn(name="promoter*id", referencedColumnName="promoter*id"), @ORM\JoinColumn(name="date", referencedColumnName="date") } ) ``` I got error: "The column promoter_id must be mapped to a field in class Sale since it is referenced by a join column of another class".
admin added the Bug label 2026-01-22 13:39:26 +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#2067