title: Silverstripe looping has_many inside template
body: <p>I want to loop my products on template using <code>has_many</code> relation but somthing am doing wrong. First i create DataObject <code>Product</code> with <code>has_one</code> and create ModelAdmin for adding new products. After that i create ProductPage model and controller and ProductPage template where i loop products. </p>
  
  <p><strong>Data Object:</strong></p>
  
  <pre><code>&lt;?php
  
  class Product extends DataObject
  {
      private static $db = array(
          'Name' =&gt; 'Varchar',
          'Description' =&gt; 'HTMLText',
          'Price' =&gt; 'Decimal'
      );
  
      private static $has_one = array(
          'Photo' =&gt; 'Image',
          'ProductPage' =&gt; 'ProductPage'
      );
  
      public function getCMSFields()
      {
          $fields = FieldList::create(TabSet::create('Root'));
  
          $fields-&gt;addFieldsToTab('Root.Main', array(
              TextField::create('Name'),
              HtmlEditorField::create('Opis'),
              NumericField::create('Price'),
              UploadField::create('Photo')
          ));
  
          return $fields;
      }
  
  }
  </code></pre>
  
  <p>ProductPage:</p>
  
  <pre><code>class ProductPage extends Page
  {
      private static $has_many = array(
          'Products' =&gt; 'Product'
      );
  }
  
  class ProductPage_Controller extends Page_Controller
  {
  
  }
  </code></pre>
  
  <p><strong>Template:</strong></p>
  
  <pre><code>&lt;% if $Products %&gt;
      &lt;% loop $Products %&gt;
          &lt;div class="col-md-4"&gt;
              &lt;h3&gt;$Name&lt;/h3&gt;
          &lt;/div&gt;
      &lt;% end_loop %&gt;
  &lt;% else %&gt;
      No product found
  &lt;% end_if %&gt;
  </code></pre>
  
  <p>Am get all time <code>No product found</code> but i have products in database. </p>
  
  <p>What can be problem?</p>