title: Doctrine2 strictly trying to inser t NULL when i use one-to-one and many-to-one relations
body: <p><strong>Places.yml</strong></p>
  
  <pre><code>manyToOne:
    excursions:
      targetEntity: Excursions
      inversedBy: places
      inverse: true
      cascade: ["ALL"]
      nullable: false
      joinColumn:
        name: idx
        referencedColumnName: place_id
  </code></pre>
  
  <p><strong>Excursions.yml</strong></p>
  
  <pre><code>oneToOne:
    places:
      targetEntity: Places
      mappedBy: excursions
  </code></pre>
  
  <p>Excursion has one place_id. so <code>$exccursion-&gt;getPlaces()</code> returns ONE row only.</p>
  
  <p>Now, when i trying to insert a value to the <code>Places</code> table, Doctrine2 says <code>Not null violation: 7 ERROR: null value in column "idx" violates not-null constraint</code></p>
  
  <p>I have no idea why this is happening. If i remove <code>manyToOne</code> then insert works. But this time <code>getPlaces()</code> is not working.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>The probloem is, i use mappedBy against the database. I should only do this:</p>
  
  <p><strong>Places.yml</strong></p>
  
  <pre><code>manyToOne:
    --remove--
  </code></pre>
  
  <p><strong>Excursions.yml</strong></p>
  
  <pre><code>oneToOne:
    places:
      targetEntity: Places
      joinColumn:
          name: place_id
          referencedColumnName: idx
  </code></pre>
  
  <p>This solves the problem. But i found this by trying/playing randomly. So, i don't know why :) Anyone knows that please <code>explain</code> me.</p>