{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1469","labels_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1469/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1469/comments","events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1469/events","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1469","id":111771570,"number":1469,"title":"Implemented QueryType View","user":{"login":"bdunogier","id":235928,"avatar_url":"https://avatars.githubusercontent.com/u/235928?v=3","gravatar_id":"","url":"https://api.github.com/users/bdunogier","html_url":"https://github.com/bdunogier","followers_url":"https://api.github.com/users/bdunogier/followers","following_url":"https://api.github.com/users/bdunogier/following{/other_user}","gists_url":"https://api.github.com/users/bdunogier/gists{/gist_id}","starred_url":"https://api.github.com/users/bdunogier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bdunogier/subscriptions","organizations_url":"https://api.github.com/users/bdunogier/orgs","repos_url":"https://api.github.com/users/bdunogier/repos","events_url":"https://api.github.com/users/bdunogier/events{/privacy}","received_events_url":"https://api.github.com/users/bdunogier/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-16T06:43:00Z","updated_at":"2015-10-16T18:51:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1469","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1469","diff_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1469.diff","patch_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1469.patch"},"body":"> Implements [EZP-24624](https://jira.ez.no/browse/EZP-24624)\r\n> Status: working, reviews accepted\r\n\r\nThis implements the Query controller according to the [named queries specifications](https://github.com/ezsystems/ezpublish-kernel/blob/master/doc/specifications/proposed/named_queries/developer_documentation.md).\r\n\r\nA new Platform controller is added to the Core: `ez_query` (alias for `ezpublish.controller.query`). It exposes three actions: `location`, `content` and `contentInfo`. The views (template, controller, ...) can be configured using the `query_type_view` key.\r\n\r\nIt also **supports PagerFanta** by default (could be a separate story, it's in a distinct commit). The list variable assigned to the view template is a pager instead of being an array of value objects. The behaviour can be disabled by setting `enable_pager: false` in the view configuration.\r\n\r\n### TODO\r\n- [x] Consider replacing the `xxx_list` variables with `PagerFanta` instances transparently"},"comment":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/comments/148805438","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1469#issuecomment-148805438","issue_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1469","id":148805438,"user":{"login":"ezrobot","id":681611,"avatar_url":"https://avatars.githubusercontent.com/u/681611?v=3","gravatar_id":"","url":"https://api.github.com/users/ezrobot","html_url":"https://github.com/ezrobot","followers_url":"https://api.github.com/users/ezrobot/followers","following_url":"https://api.github.com/users/ezrobot/following{/other_user}","gists_url":"https://api.github.com/users/ezrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/ezrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezrobot/subscriptions","organizations_url":"https://api.github.com/users/ezrobot/orgs","repos_url":"https://api.github.com/users/ezrobot/repos","events_url":"https://api.github.com/users/ezrobot/events{/privacy}","received_events_url":"https://api.github.com/users/ezrobot/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T18:51:45Z","updated_at":"2015-10-16T18:51:45Z","body":"This Pull Request does not respect [PSR-2 Coding Standards](http://www.php-fig.org/psr/psr-2/), please, see the suggested diff below:\n\n```diff\nLoaded config from \"/jenkins/jenkins.std/jobs/PAPI-Pull-Request-code-sniffer/workspace/.php_cs\"\nF.F\nLegend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error\n   1) eZ/Bundle/PlatformBehatBundle/QueryType/MatchNameQueryType.php (phpdoc_short_description, unused_use)\n      ---------- begin diff ----------\n      --- Original\n      +++ New\n      @@ @@\n       \n      -use eZ\\Publish\\API\\Repository\\Values\\Content\\Query;\n       use eZ\\Publish\\Core\\QueryType\\QueryType;\n       \n       /**\n      - * Used by the named_queries scenario\n      + * Used by the named_queries scenario.\n        */\n       class MatchNameQueryType extends EmptyQuery implements QueryType\n       {\n           public static function getName()\n           {\n               return 'EzPlatformBehatBundle:MatchName';\n           }\n       }\n       \n      \n      ---------- end diff ----------\n\n   2) eZ/Publish/Core/MVC/Symfony/View/Tests/Builder/QueryTypeViewBuilderTest.php (unused_use)\n      ---------- begin diff ----------\n      --- Original\n      +++ New\n      @@ @@\n       use eZ\\Publish\\API\\Repository\\Values\\Content\\Query;\n      -use eZ\\Publish\\API\\Repository\\Values\\Content\\Search\\SearchResult;\n       use eZ\\Publish\\Core\\MVC\\Symfony\\View\\Builder\\QueryTypeViewBuilder;\n       use eZ\\Publish\\Core\\MVC\\Symfony\\View\\QueryTypeView;\n       \n       class QueryTypeViewBuilderTest extends \\PHPUnit_Framework_TestCase\n       {\n           /** @var \\eZ\\Publish\\Core\\MVC\\Symfony\\View\\ParametersInjector|\\PHPUnit_Framework_MockObject_MockObject */\n           private $injectorMock;\n       \n           /** @var \\eZ\\Publish\\Core\\QueryType\\QueryTypeRegistry|\\PHPUnit_Framework_MockObject_MockObject */\n           private $registryMock;\n       \n           /** @var \\eZ\\Publish\\API\\Repository\\SearchService|\\PHPUnit_Framework_MockObject_MockObject */\n           private $searchServiceMock;\n       \n           /** @var \\eZ\\Publish\\Core\\MVC\\Symfony\\View\\Builder\\QueryTypeViewBuilder */\n           private $builder;\n       \n           /** @var \\eZ\\Publish\\Core\\MVC\\Symfony\\View\\Configurator|\\PHPUnit_Framework_MockObject_MockObject */\n           private $viewConfiguratorMock;\n       \n           public function setUp()\n           {\n               $this->registryMock = $this->getMock('eZ\\Publish\\Core\\QueryType\\QueryTypeRegistry');\n               $this->searchServiceMock = $this->getMock('eZ\\Publish\\API\\Repository\\SearchService');\n               $this->injectorMock = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\View\\ParametersInjector');\n               $this->viewConfiguratorMock = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\View\\Configurator');\n               $this->builder = new QueryTypeViewBuilder(\n                   $this->registryMock,\n                   $this->searchServiceMock,\n                   $this->viewConfiguratorMock,\n                   $this->injectorMock\n               );\n           }\n       \n           public function testMatches()\n           {\n               self::assertTrue($this->builder->matches('ez_query:content'));\n               self::assertTrue($this->builder->matches('ez_query:location'));\n               self::assertTrue($this->builder->matches('ez_query:contentInfo'));\n               self::assertFalse($this->builder->matches('any:foo'));\n           }\n       \n           /**\n            * @dataProvider builderParametersProvider\n            */\n           public function testBuild($controller, $query, $expectedSearchedType, $searchMethod)\n           {\n               $parameters = ['_controller' => $controller, 'queryTypeName' => 'latest_articles', 'viewType' => 'full'];\n       \n               $queryTypeMock = $this->getMock('eZ\\Publish\\Core\\QueryType\\QueryType');\n               $queryTypeMock\n                   ->expects($this->once())\n                   ->method('getQuery')\n                   ->will($this->returnValue($query));\n       \n               $this->registryMock\n                   ->expects($this->once())\n                   ->method('getQueryType')\n                   ->with('latest_articles')\n                   ->will($this->returnValue($queryTypeMock));\n       \n               $view = $this->builder->buildView($parameters);\n       \n               self::assertEquals('latest_articles', $view->getQueryTypeName());\n               self::assertInstanceOf('Pagerfanta\\Pagerfanta', $view->getSearchResult());\n               self::assertEquals($expectedSearchedType, $view->getSearchedType());\n           }\n       \n           public function builderParametersProvider()\n           {\n               return [\n                   ['ez_query:content', new Query(), QueryTypeView::SEARCH_TYPE_CONTENT, 'findContent'],\n                   ['ez_query:contentInfo', new Query(), QueryTypeView::SEARCH_TYPE_CONTENT_INFO, 'findContentInfo'],\n                   ['ez_query:location', new LocationQuery(), QueryTypeView::SEARCH_TYPE_LOCATION, 'findLocations'],\n               ];\n           }\n       }\n       \n      \n      ---------- end diff ----------\n\nFixed all files in 4.998 seconds, 11.250 MB memory used\n```\n"}}