php - Symfony 2 Catchable Fatal Error: Argument 1 passed to Sg\DatatablesBundle\Datatable\::__construct() must be an instance of -
i'm using stwe/datatablesbundle symfony 2 (http://github.com/stwe/datatablesbundle) (stable version v0.6.1) , getting following error:
catchable fatal error: argument 1 passed sg\datatablesbundle\datatable\view\abstractdatatableview::__construct() must instance of symfony\bundle\twigbundle\twigengine, none given, called in g:\server\www\bongoapp\app\cache\dev\appdevdebugprojectcontainer.php on line 418 , defined
i have tried following answer here, not working me. doing wrong? code below , in advance:
generated datatable class:
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->getfeatures() ->setserverside(true) ->setprocessing(true); $this->getajax()->seturl($this->getrouter()->generate('artist_results')); $this->setstyle(self::bootstrap_3_style); $this->getcolumnbuilder() ->add('id', 'column', array('title' => 'id',)) ->add('name', 'column', array('title' => 'name',)) ->add('bangla_name', 'column', array('title' => 'bangla_name',)) ->add('birth_place', 'column', array('title' => 'birth_place',)) ->add('priority', 'column', array('title' => 'priority',)) ->add('bday', 'column', array('title' => 'bday',)) ->add('bmonth', 'column', array('title' => 'bmonth',)) ->add('byear', 'column', array('title' => 'byear',)) ->add('sex', 'column', array('title' => 'sex',)) ->add('dod_day', 'column', array('title' => 'dod_day',)) ->add('dod_month', 'column', array('title' => 'dod_month',)) ->add('dod_year', 'column', array('title' => 'dod_year',)) ->add('bio_english', 'column', array('title' => 'bio_english',)) ->add('bio_bangla', 'column', array('title' => 'bio_bangla',)) ->add('real_name', 'column', array('title' => 'real_name',)) ->add('debut', 'column', array('title' => 'debut',)) ->add('graphics.id', 'column', array('title' => 'graphics id',)) ->add('graphics.thumbnail', 'column', array('title' => 'graphics thumbnail',)) ->add('graphics.poster', 'column', array('title' => 'graphics poster',)) ->add('graphics.feature', 'column', array('title' => 'graphics feature',)) ->add('graphics.gallery', 'column', array('title' => 'graphics gallery',)) ; } /** * {@inheritdoc} */ public function getentity() { return 'bbd\bongoappbundle\entity\artist'; } /** * {@inheritdoc} */ public function getname() { return 'artist_datatable'; } }
controller
public function indexaction() { $postdatatable = $this->get("bbd_datatables.artist"); return array( "datatable" => $postdatatable, ); } public function indexresultsaction() { /** * @var \sg\datatablesbundle\datatable\data\datatabledata $datatable */ $datatable = $this->get("bbd_datatables.datatable")->getdatatable($this->get("bbd_datatables.artist")); return $datatable->getresponse(); }
services.yml
bbd_datatables.artist: class: bbd\bongoappbundle\datatables\artistdatatable tags: - { name: bbd.datatable.view }
and index.html.twig
{% block content_content %} {{ datatable_render_html(datatable) }} {% endblock %} {% block javascripts %} {{ parent() }} {{ datatable_render_js(datatable) }} {% endblock %}
it seems you've used wrong tag.
bbd_datatables.artist: class: bbd\bongoappbundle\datatables\artistdatatable tags: - { name: sg.datatable.view }
Comments
Post a Comment