Php Symfony 2可捕获的致命错误:传递给Sg\DatatablesBundle\Datatable\:\uu构造()的参数1必须是的实例

Php Symfony 2可捕获的致命错误:传递给Sg\DatatablesBundle\Datatable\:\uu构造()的参数1必须是的实例,php,symfony,datatables,Php,Symfony,Datatables,我正在为symfony 2()使用stwe/DatatablesBundle(稳定版本v0.6.1),并得到以下错误: 可捕获致命错误:参数1传递给 Sg\DatatablesBundle\Datatable\View\AbstractDatatableView::\uu构造() 必须是Symfony\Bundle\TwigBundle\TwigEngine的实例,无 给予,召唤 G:\server\www\bongoapp\app\cache\dev\appDevDebugProjectCon

我正在为symfony 2()使用stwe/DatatablesBundle(稳定版本v0.6.1),并得到以下错误:

可捕获致命错误:参数1传递给 Sg\DatatablesBundle\Datatable\View\AbstractDatatableView::\uu构造() 必须是Symfony\Bundle\TwigBundle\TwigEngine的实例,无 给予,召唤 G:\server\www\bongoapp\app\cache\dev\appDevDebugProjectContainer.php 第418行,并定义

我试着按照答案去做,但对我来说不起作用。我做错了什么?代码如下,请提前感谢:

生成的数据表类:

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';
}
}
控制器

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 }
index.html.twig

{% block content_content %}
{{ datatable_render_html(datatable) }}
{% endblock %}
{% block javascripts %}
{{ parent() }}
{{ datatable_render_js(datatable) }}
{% endblock %} 

看来你用错标签了

bbd_datatables.artist:
   class: Bbd\BongoAppBundle\Datatables\ArtistDatatable
   tags:
      - { name: sg.datatable.view }
看:

我可以通过使用配置中的
parent
参数来解决此问题:

bbd_datatables.artist:
    class: Bbd\BongoAppBundle\Datatables\ArtistDatatable
    parent: sg_datatables.datatable.abstract
    tags:
        - { name: sg.datatable.view }

这将提取
AbstractDatatableView所需的参数声明

好的,谢谢你的回答,但我得到了这个。。可捕获的致命错误:参数2传递给Sg\DataTableBundle\Datatable\View\AbstractDatatableView::\uu construct()必须实现接口Symfony\Component\Translation\TranslatorInterface,无任何给定是否可以使用指向此捆绑包的链接进行注释?它似乎有更多的依赖项需要设置。它在问题中,但这里再次为您。。很抱歉再次打扰您,但仍然收到此错误:控制器必须返回响应(数组(datatable=>Object(Bbd\BongAppBundle\Datatables\ArtistDatatable))给定)。好的,我在这里错了,因为我调用的是索引,当我访问结果(IndexResultAction)时,它应该返回对象获取此错误:注意:未定义索引:列