title: doctrine2 check OneToOne related entity exists in DB
body: <p>Entity has OneToOne relation declared</p>
  
  <pre><code>/**
   * @var \Backend\SalesBundle\Entity\SalesOrder
   *
   * @ORM\OneToOne(targetEntity="Backend\CatalogBundle\Entity\CatalogProduct")
   * @ORM\JoinColumns({
   *   @ORM\JoinColumn(name="product_id", referencedColumnName="product_id")
   * })
   */
  private $product;
  </code></pre>
  
  <p>Following code will work in both cases. If database entry exists and if it doesn't</p>
  
  <pre><code>{{ item.product.productId }}
  </code></pre>
  
  <p>But when i call for field that needs to be loaded from database i have "Entity was not found." exception. All twig tests i know are not suitable for checking this because of Doctrine Proxies</p>
  
  <pre><code>{{ item.product.name }}
  {{ item.product is null }}
  {{ item.product is empty }} etc.
  </code></pre>
  
  <p>Is there any elegant way to check if related entity exists? I can do it like this, but it's not good enough for me because i steel need to call {{ item.product.productId }}</p>
  
  <pre><code>public function getProduct()
  {
      try {
          $sku = $this-&gt;product-&gt;getSku();
      } catch (\Doctrine\ORM\EntityNotFoundException $e) {
          return null;
      }
  
      return $this-&gt;product;
  }
  </code></pre>