title: What is the difference between inversedBy and mappedBy?
body: <p>I am developing my application using Zend Framework 2 and Doctrine 2. </p>
  
  <p>While writting annotations, I am unable to understand the difference between <code>mappedBy</code> and <code>inversedBy</code>.</p>
  
  <p>When should I use <code>mappedBy</code>?</p>
  
  <p>When should I use <code>inversedBy</code>?</p>
  
  <p>When should I use neither?</p>
  
  <p>Here is an example:</p>
  
  <pre><code> /**
   *
   * @ORM\OneToOne(targetEntity="\custMod\Entity\Person", mappedBy="customer")
   * @ORM\JoinColumn(name="personID", referencedColumnName="id")
   */
  protected $person;
  
  /**
   *
   * @ORM\OneToOne(targetEntity="\Auth\Entity\User")
   * @ORM\JoinColumn(name="userID", referencedColumnName="id")
   */
  protected $user;
  
  /**
   *
   * @ORM\ManyToOne (targetEntity="\custMod\Entity\Company", inversedBy="customer")
   * @ORM\JoinColumn (name="companyID", referencedColumnName="id")
   */
  protected $company;
  </code></pre>
  
  <p>I did a quick search and found the following, but I am still confused: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/3328836/problem-understanding-relation-mapping-in-doctrine-2">example 1</a></li>
  <li><a href="http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/bidirectional-references.html" rel="noreferrer">example 2</a></li>
  <li><a href="http://docs.doctrine-project.org/en/2.0.x/reference/association-mapping.html" rel="noreferrer">example 3</a></li>
  </ul>