title: Symfony 2 Catchable Fatal Error: Argument 1 passed to Sg\DatatablesBundle\Datatable\::__construct() must be an instance of
body: <p>I'm using stwe/DatatablesBundle for symfony 2 (<a href="http://github.com/stwe/DatatablesBundle" rel="nofollow noreferrer">http://github.com/stwe/DatatablesBundle</a>) (stable version v0.6.1) and getting the following error:</p>
  
  <blockquote>
    <p>Catchable Fatal Error: Argument 1 passed to
    Sg\DatatablesBundle\Datatable\View\AbstractDatatableView::__construct()
    must be an instance of Symfony\Bundle\TwigBundle\TwigEngine, none
    given, called in
    G:\server\www\bongoapp\app\cache\dev\appDevDebugProjectContainer.php
    on line 418 and defined</p>
  </blockquote>
  
  <p>I have tried following the answer <a href="https://stackoverflow.com/questions/22127944/symfony2-contexterrorexception-catchable-fatal-error-argument-1-passed-to">here</a>, but it is not working for me. What am I doing wrong? Code below and thanks in advance: </p>
  
  <p><strong>Generated datatable class:</strong> </p>
  
  <pre><code>namespace Bbd\BongoAppBundle\Datatables;
  
  use Sg\DatatablesBundle\Datatable\View\AbstractDatatableView;
  
  /**
   * Class ArtistDatatable
   *
   * @package Bbd\BongoAppBundle\Datatables
   */
   class ArtistDatatable extends AbstractDatatableView
  {
  /**
   * {@inheritdoc}
   */
  public function buildDatatableView()
  {
      $this-&gt;getFeatures()
                      -&gt;setServerSide(true)
                      -&gt;setProcessing(true);
  
              $this-&gt;getAjax()-&gt;setUrl($this-&gt;getRouter()-&gt;generate('artist_results'));
  
      $this-&gt;setStyle(self::BOOTSTRAP_3_STYLE);
  
  
      $this-&gt;getColumnBuilder()
              -&gt;add('id', 'column', array('title' =&gt; 'Id',))
              -&gt;add('name', 'column', array('title' =&gt; 'Name',))
              -&gt;add('bangla_name', 'column', array('title' =&gt; 'Bangla_name',))
              -&gt;add('birth_place', 'column', array('title' =&gt; 'Birth_place',))
              -&gt;add('priority', 'column', array('title' =&gt; 'Priority',))
              -&gt;add('bday', 'column', array('title' =&gt; 'Bday',))
              -&gt;add('bmonth', 'column', array('title' =&gt; 'Bmonth',))
              -&gt;add('byear', 'column', array('title' =&gt; 'Byear',))
              -&gt;add('sex', 'column', array('title' =&gt; 'Sex',))
              -&gt;add('dod_day', 'column', array('title' =&gt; 'Dod_day',))
              -&gt;add('dod_month', 'column', array('title' =&gt; 'Dod_month',))
              -&gt;add('dod_year', 'column', array('title' =&gt; 'Dod_year',))
              -&gt;add('bio_english', 'column', array('title' =&gt; 'Bio_english',))
              -&gt;add('bio_bangla', 'column', array('title' =&gt; 'Bio_bangla',))
              -&gt;add('real_name', 'column', array('title' =&gt; 'Real_name',))
              -&gt;add('debut', 'column', array('title' =&gt; 'Debut',))
              -&gt;add('graphics.id', 'column', array('title' =&gt; 'Graphics Id',))
              -&gt;add('graphics.thumbnail', 'column', array('title' =&gt; 'Graphics Thumbnail',))
              -&gt;add('graphics.poster', 'column', array('title' =&gt; 'Graphics Poster',))
              -&gt;add('graphics.feature', 'column', array('title' =&gt; 'Graphics Feature',))
              -&gt;add('graphics.gallery', 'column', array('title' =&gt; 'Graphics Gallery',))
              ;
  }
  
  /**
   * {@inheritdoc}
   */
  public function getEntity()
  {
      return 'Bbd\BongoAppBundle\Entity\Artist';
  }
  
  /**
   * {@inheritdoc}
   */
  public function getName()
  {
      return 'artist_datatable';
  }
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>public function indexAction()
  {
      $postDatatable = $this-&gt;get("bbd_datatables.artist");
  
      return array(
          "datatable" =&gt; $postDatatable,
      );
  }
  
  public function indexResultsAction()
  {
      /**
       * @var \Sg\DatatablesBundle\Datatable\Data\DatatableData $datatable
       */
      $datatable = $this-&gt;get("bbd_datatables.datatable")-&gt;getDatatable($this-&gt;get("bbd_datatables.artist"));
  
  
  
      return $datatable-&gt;getResponse();
  }
  </code></pre>
  
  <p><strong>services.yml</strong></p>
  
  <pre><code>  bbd_datatables.artist:
       class: Bbd\BongoAppBundle\Datatables\ArtistDatatable
       tags:
          - { name: bbd.datatable.view }
  </code></pre>
  
  <p>and <strong>index.html.twig</strong></p>
  
  <pre><code>{% block content_content %}
  {{ datatable_render_html(datatable) }}
  {% endblock %}
  {% block javascripts %}
  {{ parent() }}
  {{ datatable_render_js(datatable) }}
  {% endblock %} 
  </code></pre>