Skip to content

Instantly share code, notes, and snippets.

@dimabory
Last active May 15, 2018 10:18
Show Gist options
  • Save dimabory/789974cd0f86cdd989b1dff2792fffa5 to your computer and use it in GitHub Desktop.
Save dimabory/789974cd0f86cdd989b1dff2792fffa5 to your computer and use it in GitHub Desktop.
Bidirectional Associations (DOCTRINE)
  • The inverse side has to have the mappedBy attribute of the OneToOne, OneToMany, or ManyToMany mapping declaration.

  • The mappedBy attribute contains the name of the association-field on the owning side.

  • The owning side has to have the inversedBy attribute of the OneToOne, ManyToOne, or ManyToMany mapping declaration.

  • The inversedBy attribute contains the name of the association-field on the inverse-side.

  • ManyToOne is always the owning side of a bidirectional association.

  • OneToMany is always the inverse side of a bidirectional association.

  • The owning side of a OneToOne association is the entity with the table containing the foreign key.

  • You can pick the owning side of a many-to-many association yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment