{"action":"opened","issue":{"url":"https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/issues/491","labels_url":"https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/issues/491/labels{/name}","comments_url":"https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/issues/491/comments","events_url":"https://api.github.com/repos/sonata-project/SonataDoctrineORMAdminBundle/issues/491/events","html_url":"https://github.com/sonata-project/SonataDoctrineORMAdminBundle/issues/491","id":109498734,"number":491,"title":"Enable the access of executable Query without execute it in ProxyQuery","user":{"login":"jngermon","id":12733304,"avatar_url":"https://avatars.githubusercontent.com/u/12733304?v=3","gravatar_id":"","url":"https://api.github.com/users/jngermon","html_url":"https://github.com/jngermon","followers_url":"https://api.github.com/users/jngermon/followers","following_url":"https://api.github.com/users/jngermon/following{/other_user}","gists_url":"https://api.github.com/users/jngermon/gists{/gist_id}","starred_url":"https://api.github.com/users/jngermon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jngermon/subscriptions","organizations_url":"https://api.github.com/users/jngermon/orgs","repos_url":"https://api.github.com/users/jngermon/repos","events_url":"https://api.github.com/users/jngermon/events{/privacy}","received_events_url":"https://api.github.com/users/jngermon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-02T14:15:07Z","updated_at":"2015-10-02T14:15:07Z","closed_at":null,"body":"To use a custom DataSourceIterator I have to use get the Query of `Sonata\\DoctrineORMAdminBundle\\Datagrid\\ProxyQuery`. But a `getQuery` on it give an uncomplete query. The complete one is build in the method `Sonata\\DoctrineORMAdminBundle\\Datagrid\\ProxyQuery:execute' but the Query is immediatly executed after built.\r\nSo, I propose this solution to enable the access of executable Query ot ProxyQuery :\r\n```\r\n    /**\r\n     * {@inheritdoc}\r\n     */\r\n    public function execute(array $params = array(), $hydrationMode = null)\r\n    {\r\n        return $this->getExecutableQuery()->execute($params, $hydrationMode);\r\n    }\r\n\r\n    public function getExecutableQuery()\r\n    {\r\n        // always clone the original queryBuilder\r\n        $queryBuilder = clone $this->queryBuilder;\r\n\r\n        // todo : check how doctrine behave, potential SQL injection here ...\r\n        if ($this->getSortBy()) {\r\n            $sortBy = $this->getSortBy();\r\n            if (strpos($sortBy, '.') === false) { // add the current alias\r\n                $sortBy = $queryBuilder->getRootAlias() . '.' . $sortBy;\r\n            }\r\n            $queryBuilder->addOrderBy($sortBy, $this->getSortOrder());\r\n        } else {\r\n            $queryBuilder->resetDQLPart('orderBy');\r\n        }\r\n\r\n        return $this->getFixedQueryBuilder($queryBuilder)->getQuery();\r\n    }\r\n```\r\nDo you think that it's the right solution ?\r\nDo you want that I do the contribution ?\r\n\r\nThank you"}}