title: How to display joined entity columns in twig template
body: <p>I don't know what I am missing, but I've been fighting with Twig and can't find out where i am mistaking.</p>
  
  <p>I have three Entities: Product, ProductImage and Category</p>
  
  <p>Every Product as One Category and One Category has Many Products.
  Every Product has Many Images.</p>
  
  <p>I am able to list the images collection, that's not a problem.</p>
  
  <p>The problem is that I just can't get the category description (<strong><em>product.categories.description</em></strong>) for each product in my Twig template file, as is:</p>
  
  <pre><code>{% extends '::base.html.twig' %}
  {% block body %}
  &lt;div id="vitrines"&gt;
      {{ debug products }}
      {% for product in products %}
          &lt;div class="boxVitrine"&gt;
              {% for image in product.images %}
                  {% if(image.oneOfType == 'thumb') %}
                      &lt;img src="{{ asset('bundles/artevitrinesite/products/') }}{{ image.filename }}" /&gt;
                  {% endif %}
              {% endfor %}
              &lt;div class="info"&gt;
                  &lt;div class="container"&gt;
                      &lt;div class="top"&gt;
                          &lt;div class="code"&gt;
                              Cod: &lt;span class="red1"&gt;&lt;strong&gt;{{ product.code }}&lt;/strong&gt;&lt;/span&gt;
                              &lt;br /&gt;{{ product.categories.description }}
                          &lt;/div&gt;
                          &lt;div class="price"&gt;{{ product.price | bigprice | raw }}&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      {% endfor %}
  &lt;/div&gt;
  {%endblock%}
  </code></pre>
  
  <p>So, I have these two classes:</p>
  
  <pre><code>class Product
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
  
      /**
       * @see Entity/Category
       * 
       * @var integer $categoryId
       * 
       * @ORM\ManyToOne(targetEntity="Category", inversedBy="products")
       * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
       *
       */    
      protected $categoryId;
  
  
      /**
       * 
       * @var string $title
       * 
       * @ORM\Column(name="title", type="string", length=255, nullable=false)
       * 
       */
      protected $title;        
  
  
      /**
       * 
       * @var string $description
       * 
       * @ORM\Column(name="description", type="text", nullable=false )
       * 
       */      
      protected $description;
  
      /**
       * 
       * @var string $price
       * 
       * @ORM\Column(name="price", type="decimal", precision=9, scale=2, nullable=false)
       * 
       */      
      protected $price;
  
  
      /**
       * 
       * @var string $status
       * 
       * @ORM\Column(name="status", type="boolean")
       * 
       */      
      protected $status;
  
      /**
       * 
       * @var string $createdOn
       * 
       * @ORM\Column(name="created_on", type="datetime")
       * 
       */      
      protected $createdOn;
  
  
      /**
       * @var \Doctrine\Common\Collections\ArrayCollection $images
       * @ORM\OneToMany(targetEntity="ProductImage", mappedBy="productId")
       *
       */
      protected $images;
      /**
       * Constructor
       */
      public function __construct()
      {
          $this-&gt;images = new \Doctrine\Common\Collections\ArrayCollection();
      }
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set title
       *
       * @param string $title
       * @return Product
       */
      public function setTitle($title)
      {
          $this-&gt;title = $title;
  
          return $this;
      }
  
      /**
       * Get title
       *
       * @return string 
       */
      public function getTitle()
      {
          return $this-&gt;title;
      }
  
      /**
       * Set description
       *
       * @param string $description
       * @return Product
       */
      public function setDescription($description)
      {
          $this-&gt;description = $description;
  
          return $this;
      }
  
      /**
       * Get description
       *
       * @return string 
       */
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      /**
       * Set price
       *
       * @param float $price
       * @return Product
       */
      public function setPrice($price)
      {
          $this-&gt;price = $price;
  
          return $this;
      }
  
      /**
       * Get price
       *
       * @return float 
       */
      public function getPrice()
      {
          return $this-&gt;price;
      }    
  
      /**
       * Set status
       *
       * @param boolean $status
       * @return Product
       */
      public function setStatus($status)
      {
          $this-&gt;status = $status;
  
          return $this;
      }
  
      /**
       * Get status
       *
       * @return boolean 
       */
      public function getStatus()
      {
          return $this-&gt;status;
      }
  
      /**
       * Set createdOn
       *
       * @param \DateTime $createdOn
       * @return Product
       */
      public function setCreatedOn($createdOn)
      {
          $this-&gt;createdOn = $createdOn;
  
          return $this;
      }
  
      /**
       * Get createdOn
       *
       * @return \DateTime 
       */
      public function getCreatedOn()
      {
          return $this-&gt;createdOn;
      }
  
      /**
       * Set categoryId
       *
       * @param Category $categoryId
       * @return Product
       */
      public function setCategoryId(Category $categoryId = null)
      {
          $this-&gt;categoryId = $categoryId;
  
          return $this;
      }
  
      /**
       * Get categoryId
       *
       * @return Category 
       */
      public function getCategoryId()
      {
          return $this-&gt;categoryId;
      }
  
      /**
       * Add images
       *
       * @param \ArteVitrine\BackendBundle\Entity\ProductImage $images
       * @return Product
       */
      public function addImage(ProductImage $images)
      {
          $this-&gt;images[] = $images;
  
          return $this;
      }
  
      /**
       * Remove images
       *
       * @param ProductImage $images
       */
      public function removeImage(ProductImage $images)
      {
          $this-&gt;images-&gt;removeElement($images);
      }
  
      /**
       * Get images
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getImages()
      {
          return $this-&gt;images;
      }
  }
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>class Category
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;
  
      /**
       * 
       * @var string $description
       *
       * @ORM\Column(name="description", type="text", nullable=false )
       *
       */
      protected $description;
  
      /**
       * 
       * @var string $status
       * 
       * @ORM\Column(name="status", type="boolean")
       * 
       */      
      protected $status;
  
      /**
       * 
       * @var ArrayCollection $products
       * 
       * @ORM\OneToMany(targetEntity="Category", mappedBy="categoryId")
       *
       */
      protected $products;
  
      /**
       * Get id
       *
       * @return integer 
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  
      /**
       * Set description
       *
       * @param string $description
       * @return Category
       */
      public function setDescription($description)
      {
          $this-&gt;description = $description;
  
          return $this;
      }
  
      /**
       * Get description
       *
       * @return string 
       */
      public function getDescription()
      {
          return $this-&gt;description;
      }
  
      /**
       * Set status
       *
       * @param boolean $status
       * @return Category
       */
      public function setStatus($status)
      {
          $this-&gt;status = $status;
  
          return $this;
      }
  
      /**
       * Get status
       *
       * @return boolean 
       */
      public function getStatus()
      {
          return $this-&gt;status;
      }
  
      /**
       * Constructor
       */
      public function __construct()
      {
          $this-&gt;products = new ArrayCollection();
      }
  
      /**
       * Add products
       *
       * @param Category $products
       * @return Category
       */
      public function addProduct(Category $products)
      {
          $this-&gt;products[] = $products;
  
          return $this;
      }
  
      /**
       * Remove products
       *
       * @param Category $products
       */
      public function removeProduct(Category $products)
      {
          $this-&gt;products-&gt;removeElement($products);
      }
  
      /**
       * Get products
       *
       * @return \Doctrine\Common\Collections\Collection 
       */
      public function getProducts()
      {
          return $this-&gt;products;
      }
  }
  </code></pre>
  
  <p>So far, so good I just don't know how to display the category info for each product inside the loop, nor if I am doing it the right way.</p>
  
  <p>Thanks in advance.</p>