title: Adding datatables to symfony 3 - data not showing
body: <p>I tried installing datatables to my Symfony 3 project. I'm new to this and not sure where I went wrong but the data from my MySQL database are not showing. </p>
  
  <p>I have <code>{{ datatable_render(datatable) }}</code> on my index page but all it shows in a button to add another entry. </p>
  
  <p>This is my controller</p>
  
  <pre><code>namespace AppBundle\Controller;
  
  use AppBundle\Entity\Shrubs;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;use Symfony\Component\HttpFoundation\Request;
  
  /**
   * Shrub controller.
   *
   * @Route("shrubs")
   */
  class ShrubsController extends Controller
  {
      /**
       * Lists all shrub entities.
       *
       * @Route("/", name="shrubs_index")
       * @Method("GET")
       */
      public function indexAction()
      {
          $datatable = $this-&gt;get('app.datatable.shrubs');
          $datatable-&gt;buildDatatable();
         // $em = $this-&gt;getDoctrine()-&gt;getManager();
  
     // $datatable = $em-&gt;getRepository('AppBundle:Shrubs')-&gt;findAll();
  
      return $this-&gt;render('shrubs/index.html.twig', array(
          'datatable' =&gt; $datatable,
  
  
         // 'shrubs' =&gt; $shrubs,
  
      ));
  }
  /**
   * @Route("/results", name="shrubs_results")
   */
  public function indexResultsAction()
  {
      $datatable = $this-&gt;get('app.datatable.shrubs');
      $datatable-&gt;buildDatatable();
  
      $query = $this-&gt;get('shrubs_datatable')-&gt;getQueryFrom($datatable);
  
      return $query-&gt;getResponse();
  }
  </code></pre>
  
  <p>ShrubDatatable</p>
  
  <pre><code> &lt;?php
  
  namespace AppBundle\Datatables;
  
  use Sg\DatatablesBundle\Datatable\View\AbstractDatatableView;
  use Sg\DatatablesBundle\Datatable\View\Style;
  
  /**
   * Class ShrubsDatatable
   *
   * @package AppBundle\Datatables
   */
  class ShrubsDatatable extends AbstractDatatableView
  {
      /**
       * {@inheritdoc}
       */
      public function buildDatatable(array $options = array())
      {
          $this-&gt;topActions-&gt;set(array(
              'start_html' =&gt; '&lt;div class="row"&gt;&lt;div class="col-sm-3"&gt;',
              'end_html' =&gt; '&lt;hr&gt;&lt;/div&gt;&lt;/div&gt;',
              'actions' =&gt; array(
                  array(
                      'route' =&gt; $this-&gt;router-&gt;generate('shrubs_new'),
                      'label' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.new'),
                      'icon' =&gt; 'glyphicon glyphicon-plus',
                      'attributes' =&gt; array(
                          'rel' =&gt; 'tooltip',
                          'title' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.new'),
                          'class' =&gt; 'btn btn-primary',
                          'role' =&gt; 'button'
                      ),
                  )
              )
          ));
  
          $this-&gt;features-&gt;set(array(
              'auto_width' =&gt; true,
              'defer_render' =&gt; false,
              'info' =&gt; true,
              'jquery_ui' =&gt; false,
              'length_change' =&gt; true,
              'ordering' =&gt; true,
              'paging' =&gt; true,
              'processing' =&gt; true,
              'scroll_x' =&gt; false,
              'scroll_y' =&gt; '',
              'searching' =&gt; true,
              'state_save' =&gt; false,
              'delay' =&gt; 0,
              'extensions' =&gt; array(),
              'highlight' =&gt; false,
              'highlight_color' =&gt; 'red'
          ));
  
          $this-&gt;ajax-&gt;set(array(
              'url' =&gt; $this-&gt;router-&gt;generate('shrubs_index'),
              'type' =&gt; 'GET',
              'pipeline' =&gt; 0
          ));
  
          $this-&gt;options-&gt;set(array(
              'display_start' =&gt; 0,
              'defer_loading' =&gt; -1,
              'dom' =&gt; 'lfrtip',
              'length_menu' =&gt; array(10, 25, 50, 100),
              'order_classes' =&gt; true,
              'order' =&gt; array(array(0, 'asc')),
              'order_multi' =&gt; true,
              'page_length' =&gt; 10,
              'paging_type' =&gt; Style::FULL_NUMBERS_PAGINATION,
              'renderer' =&gt; '',
              'scroll_collapse' =&gt; false,
              'search_delay' =&gt; 0,
              'state_duration' =&gt; 7200,
              'stripe_classes' =&gt; array(),
              'class' =&gt; Style::BOOTSTRAP_3_STYLE,
              'individual_filtering' =&gt; false,
              'individual_filtering_position' =&gt; 'head',
              'use_integration_options' =&gt; true,
              'force_dom' =&gt; false,
              'row_id' =&gt; 'id'
          ));
  
          $this-&gt;columnBuilder
              -&gt;add('botanicalname', 'column', array(
                  'title' =&gt; 'Botanicalname',
              ))
              -&gt;add('commonname', 'column', array(
                  'title' =&gt; 'Commonname',
              ))
              -&gt;add('borderlinehardy', 'column', array(
                  'title' =&gt; 'Borderlinehardy',
              ))
              -&gt;add('phpreference', 'column', array(
                  'title' =&gt; 'Phpreference',
              ))
              -&gt;add('wetsoil', 'column', array(
                  'title' =&gt; 'Wetsoil',
              ))
              -&gt;add('moistsoil', 'column', array(
                  'title' =&gt; 'Moistsoil',
              ))
              -&gt;add('peatysoil', 'column', array(
                  'title' =&gt; 'Peatysoil',
              ))
              -&gt;add('welldrainedsoil', 'column', array(
                  'title' =&gt; 'Welldrainedsoil',
              ))
              -&gt;add('drought', 'column', array(
                  'title' =&gt; 'Drought',
              ))
              -&gt;add('claysoil', 'column', array(
                  'title' =&gt; 'Claysoil',
              ))
              -&gt;add('sandysoil', 'column', array(
                  'title' =&gt; 'Sandysoil',
              ))
              -&gt;add('loamsoil', 'column', array(
                  'title' =&gt; 'Loamsoil',
              ))
              -&gt;add('infertilesoil', 'column', array(
                  'title' =&gt; 'Infertilesoil',
              ))
              -&gt;add('richsoil', 'column', array(
                  'title' =&gt; 'Richsoil',
              ))
              -&gt;add('compactedsoil', 'column', array(
                  'title' =&gt; 'Compactedsoil',
              ))
              -&gt;add('cityconditions', 'column', array(
                  'title' =&gt; 'Cityconditions',
              ))
              -&gt;add('pollution', 'column', array(
                  'title' =&gt; 'Pollution',
              ))
              -&gt;add('salt', 'column', array(
                  'title' =&gt; 'Salt',
              ))
              -&gt;add('windy', 'column', array(
                  'title' =&gt; 'Windy',
              ))
              -&gt;add('shade', 'column', array(
                  'title' =&gt; 'Shade',
              ))
              -&gt;add('partshade', 'column', array(
                  'title' =&gt; 'Partshade',
              ))
              -&gt;add('fullsun', 'column', array(
                  'title' =&gt; 'Fullsun',
              ))
              -&gt;add('pestproblem', 'column', array(
                  'title' =&gt; 'Pestproblem',
              ))
              -&gt;add('id', 'column', array(
                  'title' =&gt; 'Id',
              ))
              -&gt;add(null, 'action', array(
                  'title' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.title'),
                  'actions' =&gt; array(
                      array(
                          'route' =&gt; 'shrubs_show',
                          'route_parameters' =&gt; array(
                              'id' =&gt; 'id'
                          ),
                          'label' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.show'),
                          'icon' =&gt; 'glyphicon glyphicon-eye-open',
                          'attributes' =&gt; array(
                              'rel' =&gt; 'tooltip',
                              'title' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.show'),
                              'class' =&gt; 'btn btn-primary btn-xs',
                              'role' =&gt; 'button'
                          ),
                      ),
                      array(
                          'route' =&gt; 'shrubs_edit',
                          'route_parameters' =&gt; array(
                              'id' =&gt; 'id'
                          ),
                          'label' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.edit'),
                          'icon' =&gt; 'glyphicon glyphicon-edit',
                          'attributes' =&gt; array(
                              'rel' =&gt; 'tooltip',
                              'title' =&gt; $this-&gt;translator-&gt;trans('datatables.actions.edit'),
                              'class' =&gt; 'btn btn-primary btn-xs',
                              'role' =&gt; 'button'
                          ),
                      )
                  )
              ))
          ;
      }
  
      /**
       * {@inheritdoc}
       */
      public function getEntity()
      {
          return 'AppBundle\Entity\Shrubs';
      }
  
      /**
       * {@inheritdoc}
       */
      public function getName()
      {
          return 'shrubs_datatable';
      }
  }
  </code></pre>
  
  <p>Entity\Shrubs</p>
  
  <pre><code>    &lt;?php
  
  namespace AppBundle\Entity;
  
  /**
   * Shrubs
   */
  class Shrubs
  {
      /**
       * @var string
       */
      private $botanicalname;
  
      /**
       * @var string
       */
      private $commonname;
  
      /**
       * @var string
       */
      private $borderlinehardy;
  
      /**
       * @var string
       */
      private $phpreference;
  
      /**
       * @var string
       */
      private $wetsoil;
  
      /**
       * @var string
       */
      private $moistsoil;
  
      /**
       * @var string
       */
      private $peatysoil;
  
      /**
       * @var string
       */
      private $welldrainedsoil;
  
      /**
       * @var string
       */
      private $drought;
  
      /**
       * @var string
       */
      private $claysoil;
  
      /**
       * @var string
       */
      private $sandysoil;
  
      /**
       * @var string
       */
      private $loamsoil;
  
      /**
       * @var string
       */
      private $infertilesoil;
  
      /**
       * @var string
       */
      private $richsoil;
  
      /**
       * @var string
       */
      private $compactedsoil;
  
      /**
       * @var string
       */
      private $cityconditions;
  
      /**
       * @var string
       */
      private $pollution;
  
      /**
       * @var string
       */
      private $salt;
  
      /**
       * @var string
       */
      private $windy;
  
      /**
       * @var string
       */
      private $shade;
  
      /**
       * @var string
       */
      private $partshade;
  
      /**
       * @var string
       */
      private $fullsun;
  
      /**
       * @var string
       */
      private $pestproblem;
  
      /**
       * @var integer
       */
      private $id;
  
  
      /**
       * Set botanicalname
       *
       * @param string $botanicalname
       *
       * @return Shrubs
       */
      public function setBotanicalname($botanicalname)
      {
          $this-&gt;botanicalname = $botanicalname;
  
          return $this;
      }
  
      /**
       * Get botanicalname
       *
       * @return string
       */
      public function getBotanicalname()
      {
          return $this-&gt;botanicalname;
      }
  
      /**
       * Set commonname
       *
       * @param string $commonname
       *
       * @return Shrubs
       */
      public function setCommonname($commonname)
      {
          $this-&gt;commonname = $commonname;
  
          return $this;
      }
  
      /**
       * Get commonname
       *
       * @return string
       */
      public function getCommonname()
      {
          return $this-&gt;commonname;
      }
  
      /**
       * Set borderlinehardy
       *
       * @param string $borderlinehardy
       *
       * @return Shrubs
       */
      public function setBorderlinehardy($borderlinehardy)
      {
          $this-&gt;borderlinehardy = $borderlinehardy;
  
          return $this;
      }
  
      /**
       * Get borderlinehardy
       *
       * @return string
       */
      public function getBorderlinehardy()
      {
          return $this-&gt;borderlinehardy;
      }
  
      /**
       * Set phpreference
       *
       * @param string $phpreference
       *
       * @return Shrubs
       */
      public function setPhpreference($phpreference)
      {
          $this-&gt;phpreference = $phpreference;
  
          return $this;
      }
  
      /**
       * Get phpreference
       *
       * @return string
       */
      public function getPhpreference()
      {
          return $this-&gt;phpreference;
      }
  
      /**
       * Set wetsoil
       *
       * @param string $wetsoil
       *
       * @return Shrubs
       */
      public function setWetsoil($wetsoil)
      {
          $this-&gt;wetsoil = $wetsoil;
  
          return $this;
      }
  
      /**
       * Get wetsoil
       *
       * @return string
       */
      public function getWetsoil()
      {
          return $this-&gt;wetsoil;
      }
  
      /**
       * Set moistsoil
       *
       * @param string $moistsoil
       *
       * @return Shrubs
       */
      public function setMoistsoil($moistsoil)
      {
          $this-&gt;moistsoil = $moistsoil;
  
          return $this;
      }
  
      /**
       * Get moistsoil
       *
       * @return string
       */
      public function getMoistsoil()
      {
          return $this-&gt;moistsoil;
      }
  
      /**
       * Set peatysoil
       *
       * @param string $peatysoil
       *
       * @return Shrubs
       */
      public function setPeatysoil($peatysoil)
      {
          $this-&gt;peatysoil = $peatysoil;
  
          return $this;
      }
  
      /**
       * Get peatysoil
       *
       * @return string
       */
      public function getPeatysoil()
      {
          return $this-&gt;peatysoil;
      }
  
      /**
       * Set welldrainedsoil
       *
       * @param string $welldrainedsoil
       *
       * @return Shrubs
       */
      public function setWelldrainedsoil($welldrainedsoil)
      {
          $this-&gt;welldrainedsoil = $welldrainedsoil;
  
          return $this;
      }
  
      /**
       * Get welldrainedsoil
       *
       * @return string
       */
      public function getWelldrainedsoil()
      {
          return $this-&gt;welldrainedsoil;
      }
  
      /**
       * Set drought
       *
       * @param string $drought
       *
       * @return Shrubs
       */
      public function setDrought($drought)
      {
          $this-&gt;drought = $drought;
  
          return $this;
      }
  
      /**
       * Get drought
       *
       * @return string
       */
      public function getDrought()
      {
          return $this-&gt;drought;
      }
  
      /**
       * Set claysoil
       *
       * @param string $claysoil
       *
       * @return Shrubs
       */
      public function setClaysoil($claysoil)
      {
          $this-&gt;claysoil = $claysoil;
  
          return $this;
      }
  
      /**
       * Get claysoil
       *
       * @return string
       */
      public function getClaysoil()
      {
          return $this-&gt;claysoil;
      }
  
      /**
       * Set sandysoil
       *
       * @param string $sandysoil
       *
       * @return Shrubs
       */
      public function setSandysoil($sandysoil)
      {
          $this-&gt;sandysoil = $sandysoil;
  
          return $this;
      }
  
      /**
       * Get sandysoil
       *
       * @return string
       */
      public function getSandysoil()
      {
          return $this-&gt;sandysoil;
      }
  
      /**
       * Set loamsoil
       *
       * @param string $loamsoil
       *
       * @return Shrubs
       */
      public function setLoamsoil($loamsoil)
      {
          $this-&gt;loamsoil = $loamsoil;
  
          return $this;
      }
  
      /**
       * Get loamsoil
       *
       * @return string
       */
      public function getLoamsoil()
      {
          return $this-&gt;loamsoil;
      }
  
      /**
       * Set infertilesoil
       *
       * @param string $infertilesoil
       *
       * @return Shrubs
       */
      public function setInfertilesoil($infertilesoil)
      {
          $this-&gt;infertilesoil = $infertilesoil;
  
          return $this;
      }
  
      /**
       * Get infertilesoil
       *
       * @return string
       */
      public function getInfertilesoil()
      {
          return $this-&gt;infertilesoil;
      }
  
      /**
       * Set richsoil
       *
       * @param string $richsoil
       *
       * @return Shrubs
       */
      public function setRichsoil($richsoil)
      {
          $this-&gt;richsoil = $richsoil;
  
          return $this;
      }
  
      /**
       * Get richsoil
       *
       * @return string
       */
      public function getRichsoil()
      {
          return $this-&gt;richsoil;
      }
  
      /**
       * Set compactedsoil
       *
       * @param string $compactedsoil
       *
       * @return Shrubs
       */
      public function setCompactedsoil($compactedsoil)
      {
          $this-&gt;compactedsoil = $compactedsoil;
  
          return $this;
      }
  
      /**
       * Get compactedsoil
       *
       * @return string
       */
      public function getCompactedsoil()
      {
          return $this-&gt;compactedsoil;
      }
  
      /**
       * Set cityconditions
       *
       * @param string $cityconditions
       *
       * @return Shrubs
       */
      public function setCityconditions($cityconditions)
      {
          $this-&gt;cityconditions = $cityconditions;
  
          return $this;
      }
  
      /**
       * Get cityconditions
       *
       * @return string
       */
      public function getCityconditions()
      {
          return $this-&gt;cityconditions;
      }
  
      /**
       * Set pollution
       *
       * @param string $pollution
       *
       * @return Shrubs
       */
      public function setPollution($pollution)
      {
          $this-&gt;pollution = $pollution;
  
          return $this;
      }
  
      /**
       * Get pollution
       *
       * @return string
       */
      public function getPollution()
      {
          return $this-&gt;pollution;
      }
  
      /**
       * Set salt
       *
       * @param string $salt
       *
       * @return Shrubs
       */
      public function setSalt($salt)
      {
          $this-&gt;salt = $salt;
  
          return $this;
      }
  
      /**
       * Get salt
       *
       * @return string
       */
      public function getSalt()
      {
          return $this-&gt;salt;
      }
  
      /**
       * Set windy
       *
       * @param string $windy
       *
       * @return Shrubs
       */
      public function setWindy($windy)
      {
          $this-&gt;windy = $windy;
  
          return $this;
      }
  
      /**
       * Get windy
       *
       * @return string
       */
      public function getWindy()
      {
          return $this-&gt;windy;
      }
  
      /**
       * Set shade
       *
       * @param string $shade
       *
       * @return Shrubs
       */
      public function setShade($shade)
      {
          $this-&gt;shade = $shade;
  
          return $this;
      }
  
      /**
       * Get shade
       *
       * @return string
       */
      public function getShade()
      {
          return $this-&gt;shade;
      }
  
      /**
       * Set partshade
       *
       * @param string $partshade
       *
       * @return Shrubs
       */
      public function setPartshade($partshade)
      {
          $this-&gt;partshade = $partshade;
  
          return $this;
      }
  
      /**
       * Get partshade
       *
       * @return string
       */
      public function getPartshade()
      {
          return $this-&gt;partshade;
      }
  
      /**
       * Set fullsun
       *
       * @param string $fullsun
       *
       * @return Shrubs
       */
      public function setFullsun($fullsun)
      {
          $this-&gt;fullsun = $fullsun;
  
          return $this;
      }
  
      /**
       * Get fullsun
       *
       * @return string
       */
      public function getFullsun()
      {
          return $this-&gt;fullsun;
      }
  
      /**
       * Set pestproblem
       *
       * @param string $pestproblem
       *
       * @return Shrubs
       */
      public function setPestproblem($pestproblem)
      {
          $this-&gt;pestproblem = $pestproblem;
  
          return $this;
      }
  
      /**
       * Get pestproblem
       *
       * @return string
       */
      public function getPestproblem()
      {
          return $this-&gt;pestproblem;
      }
  
      /**
       * Get id
       *
       * @return integer
       */
      public function getId()
      {
          return $this-&gt;id;
      }
  }
  </code></pre>
  
  <p>I went through a tutorial and auto generated the datatables so I'm not sure what other info is needed. Please let me know and I'll add it.</p>