/**
  * Generates a dynamic route with replaced parameters
  *
  * @param array $replacements
  *
  * @return string
  */
 public function getDynamicPath(array $replacements = [])
 {
     $route = $this->requestHelper->getAttributesBagParam('_route');
     $currentAttributesParams = $this->requestHelper->getAttributesBagParam('_route_params');
     $currentQueryParams = $this->requestHelper->getCurrentRequest()->query->all();
     $routeParams = array_replace($currentAttributesParams, $replacements);
     $routeParams = array_merge($routeParams, $currentQueryParams);
     return $this->generator->generate($route, $routeParams);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getCurrentRoute()
 {
     $routeName = $this->requestHelper->getAttributesBagParam('_route');
     $route = $this->router->getRouteCollection()->get($routeName);
     if (null === $route) {
         throw new \RuntimeException('Cannot determine current route from request');
     }
     return $this->router->getRouteCollection()->get($routeName);
 }
Ejemplo n.º 3
0
 /**
  * Checks whether passed route is the same as in request
  *
  * @param string $route
  *
  * @return bool
  */
 public function checkRouteIsActive($route)
 {
     $currentRoute = $this->requestHelper->getAttributesBagParam('_route');
     return $route === $currentRoute;
 }
Ejemplo n.º 4
0
 /**
  * Checks whether the sorting option is active
  *
  * @param $column
  * @param $direction
  *
  * @return bool
  */
 protected function checkSortingIsActive($column, $direction)
 {
     $currentOrderBy = $this->requestHelper->getAttributesBagParam('orderBy');
     $currentOrderDir = $this->requestHelper->getAttributesBagParam('orderDir');
     return $column === $currentOrderBy && $direction === $currentOrderDir;
 }