public function getList() { $request = new ListTagsRequest(null, $this->getPaginationDTO(12)); $response = new ListTagsResponse($this->getPricing()); $this->dispatchQuery(new ListTagsQuery($request, $response)); $tagDTOs = $response->getTagDTOs(); $paginationDTO = $response->getPaginationDTO(); return $this->renderTemplate('tag/list.twig', ['tags' => $tagDTOs, 'pagination' => $paginationDTO]); }
public function index(Request $httpRequest) { $queryString = $httpRequest->query('q'); $request = new ListTagsRequest($queryString, $this->getPaginationDTO(20)); $response = new ListTagsResponse(); $this->dispatchQuery(new ListTagsQuery($request, $response)); $tags = $response->getTagDTOs(); $pagination = $response->getPaginationDTO(); return $this->renderTemplate('admin/tag/index.twig', ['tags' => $tags, 'pagination' => $pagination, 'queryString' => $queryString]); }
public function testHandle() { $tagService = $this->mockService->getTagService(); $dtoBuilderFactory = $this->getDTOBuilderFactory(); $queryString = 'TT'; $request = new ListTagsRequest($queryString, new PaginationDTO()); $response = new ListTagsResponse(); $handler = new ListTagsHandler($tagService, $dtoBuilderFactory); $handler->handle(new ListTagsQuery($request, $response)); $this->assertTrue($response->getTagDTOs()[0] instanceof TagDTO); $this->assertTrue($response->getPaginationDTO() instanceof PaginationDTO); }