title: How exactly to use onDelete = "SET NULL" - Doctrine2
body: <p>I have a class <strong>Category</strong> containing this:</p>
  
  <pre><code>/**
   * @ORM\OneToMany(targetEntity="Friend", mappedBy="category")
   * @ORM\OrderBy({"name" = "ASC"})
   */
  protected $friends;
  </code></pre>
  
  <p>and a class <strong>Friend</strong> with this:</p>
  
  <pre><code> /**
   * @ORM\ManyToOne(targetEntity="Category", inversedBy="friends")
   * @ORM\JoinColumn(name="category_id", referencedColumnName="id",  onDelete="SET NULL")
   */
  protected $category;
  </code></pre>
  
  <p>What I want is to be able to delete categories no matter if there are some friends from this category, and if there are - the category field for this friends to be set to NULL.</p>
  
  <p>I tried to put <code>onDelete="CASCADE"</code> to the ManyToOne annotation, then to the OneToMany, I tried what is shown above, I tried using <code>cascade={"remove"}</code> in the OneToMany annotation, and nothing worked! I couldn't find a example as well. Could you please help me?</p>