public function getDatatable(DatatableViewInterface $datatableView)
    {
        $type = $datatableView->getAjax()->getType();
        $entity = $datatableView->getEntity();

        if ('GET' === strtoupper($type)) {
            $this->parameterBag = $this->request->query;
        }

        if ('POST' === strtoupper($type)) {
            $this->parameterBag = $this->request->request;
        }

        $params = $this->parameterBag->all();

        /**
         * @var \Doctrine\ORM\Mapping\ClassMetadata
         */
        $metadata = $this->doctrine->getManager()->getClassMetadata($entity);

        /**
         * @var \Doctrine\ORM\EntityManager
         */
        $em = $this->doctrine->getManager();

        $datatableQuery = new DatatableQuery($params, $metadata, $em);
        $virtualColumns = $datatableView->getColumnBuilder()->getVirtualColumnNames();
        $datatableData = new DatatableData($params, $metadata, $em, $this->serializer, $datatableQuery, $virtualColumns);
        $datatableData->setLineFormatter($datatableView->getLineFormatter());

        return $datatableData;
    }