title: Doctrine2 - check if associated entry was deleted (unidirectional relationship)
body: <p>Application is build on Symfony2 and Doctrine2.</p>
  
  <p>I'm having unidirectional relationship OneToMany and when the associated entity entry has been deleted the reference column is still set to point to the deleted entry and this is the right behavior because it's just unidirectional association. But this is causing me a problem in a twig template because if I'm going to try to load that it will throw an error entity was not found. I was trying to check in twig using is defined but there was no difference. What would be the best way to check that if the associated entry hasn't been deleted?  </p>
  
  <p>Entity example:  </p>
  
  <pre><code>class Programme
  {
      ...
      /**
       * @var string
       *
       * @ORM\ManyToOne(targetEntity="Form")
       * @ORM\JoinColumn(name="form_id", referencedColumnName="id", nullable=true)
   */
       private $form;
      ...
  }  
  </code></pre>
  
  <p>Twig check:  </p>
  
  <pre><code>{% if programme.form is defined %}
      //always getting here
  {% endif %}  
  </code></pre>