title: Delete Relationship Doctrine
body: <p>In its simplest for I have a User and Category class, a User can belong to multiple Categories, defined as such</p>
  
  <pre><code> class Application_Model_User {
  
      public function __construct() {
          $this-&gt;userCategory = new ArrayCollection();
      }
   /**
   * Unidirectional - Users have multiple categories they belong to
   *
   * @ManyToMany(targetEntity="Application_Model_Category")
   * @JoinTable(name="user_category",
   *   joinColumns={@JoinColumn(name="user", referencedColumnName="id")},
   *   inverseJoinColumns={@JoinColumn(name="category", referencedColumnName="id")}
   * )
   */
  }
      private $userCategory;
  
      public function getUserCategories() {
         return $this-&gt;userCategory;
    }
   }
  </code></pre>
  
  <p>Adding a Category for a user is easy, but I cannot understand or see from the doc's how I would delete a particular relationship... For instance if I did</p>
  
  <pre><code>    $thing = $em-&gt;getRepository('Application_Model_User');
  
  
  $result = $thing-&gt;findOneBy(array(
    'id' =&gt; (int) 5
  ));
  foreach($result-&gt;getUserCategories() as $category) {
      if($category-&gt;getName() == 'Another Sub Cat') {
          // Delete this relationship
      }               
  }
  $em-&gt;flush();
  </code></pre>
  
  <p>I would be able to delete the relationship, if I delete the entity using remove, the whole category is removed?</p>