public function getQueryFrom(DatatableViewInterface $datatableView)
    {
        $twig = $datatableView->getTwig();

        $type = $datatableView->getAjax()->getType();
        $parameterBag = null;

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

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

        $params = $parameterBag->all();
        $query = new DatatableQuery(
            $this->serializer,
            $params,
            $datatableView,
            $this->configs,
            $twig,
            $this->imagineBundle,
            $this->doctrineExtensions,
            $this->locale
        );

        return $query;
    }