What is the difference between inversedBy and mappedBy?

后端 未结 4 1934
[愿得一人]
[愿得一人] 2020-12-04 05:26

I am developing my application using Zend Framework 2 and Doctrine 2.

While writting annotations, I am unable to understand the difference between mappedBy

4条回答
  •  佛祖请我去吃肉
    2020-12-04 06:01

    In bidirectional relationship has both an owning side and an inverse side

    mappedBy : put into The inverse side of a bidirectional relationship To refer to its owning side

    inversedBy : put into The owning side of a bidirectional relationship To refer to its inverse side

    AND

    mappedBy attribute used with the OneToOne, OneToMany, or ManyToMany mapping declaration.

    inversedBy attribute used with the OneToOne, ManyToOne, or ManyToMany mapping declaration.

    Notice : The owning side of a bidirectional relationship the side that contains the foreign key.

    there two reference about inversedBy and mappedBy into Doctrine Documentation : First Link,Second Link

提交回复
热议问题