title: Removing OneToMany elements, Doctrine2
body: <p>I've got this model;
  Itinerary, Venue, ItineraryVenue.</p>
  
  <p>I needed many to many relation between itineraries and venues but also I wanted to store some specific data about the relation (say notes, own photo, etc.), so I decided to introduce a new entity named ItineraryVenue.</p>
  
  <p>So Itinerary has collection of ItineraryVenues which in turn, refer to Venues.</p>
  
  <p>My problem is that I can't remove ItineraryVenue from a Itinerary object.</p>
  
  <pre><code>$itinerary-&gt;itineraryVenues-&gt;removeElement($itineraryVenue);
  $em-&gt;flush();
  </code></pre>
  
  <p>removes element from the php collection, but doesn't remove this $itineraryVenue from database.</p>
  
  <p>I've managed to force Doctrine2 to remove $itineraryVenue, but only when I annotate the <code>Itinerary::$itineraryVenues</code> with <code>orphanRemoval=true</code>.</p>
  
  <p>Since orphan removal treats Venue as a private property it also removes Venue entity, I don't want that.</p>
  
  <p>Is there an relation configuration option or is removing "by hand" the olny way to make it work as I want?</p>
  
  <p>Hard to believe it, it's a common relation pattern.</p>
  
  <p>Entities definitions:</p>
  
  <pre><code>class Itinerary
  {
      /**
       * @ORM\OneToMany(targetEntity="ItineraryVenue", mappedBy="itinerary", cascade={"persist", "remove"})
       */
      private $itineraryVenues;
  
      function __construct()
      {
          $this-&gt;itineraryVenues = new ArrayCollection();
      }
  }
  
  class ItineraryVenue
  {
      /**
       * @ORM\ManyToOne(targetEntity="Itinerary", inversedBy="itineraryVenues")
       */
      private $itinerary;
      /**
       * @ORM\ManyToOne(targetEntity="Venue")
       */
      private $venue;
  
      function __construct()
      {
      }
  }
  
  class Venue
  {
  }
  </code></pre>