src/Bridge/Twig/Extension/AdminExtension.php
public function getAdminUrl(ViewInterface $view, string $actionName, $entity = null)
    {
        if (!$this->isAdminActionAllowed($view, $actionName)) {
            throw new Exception('The action "'.$actionName.'" is not allowed for the admin "'.$view->getName().'"');
        }
        $configuration = $view->getAdminConfiguration();
        $parameters = [];
        $routeName = RoutingLoader::generateRouteName(
            $view->getName(),
            $actionName,
            $configuration->getParameter('routing_name_pattern')
        );

        if (null !== $entity) {
            $accessor = PropertyAccess::createPropertyAccessor();
            $actionConfiguration = $this->configurationFactory->createActionConfiguration(
                $actionName,
                $configuration->getParameter('actions')[$actionName],
                $view->getName(),
                $view->getAdminConfiguration()
            );

            foreach ($actionConfiguration->getParameter('route_requirements') as $name => $requirements) {
                $parameters[$name] = $accessor->getValue($entity, $name);
            }
        }

        return $this->router->generate($routeName, $parameters);
    }
public function getAdminUrl(ViewInterface $view, string $actionName, $entity = null)
    {
        if (!$this->isAdminActionAllowed($view, $actionName)) {
            throw new Exception('The action "'.$actionName.'" is not allowed for the admin "'.$view->getName().'"');
        }
        $configuration = $view->getAdminConfiguration();
        $parameters = [];
        $routeName = RoutingLoader::generateRouteName(
            $view->getName(),
            $actionName,
            $configuration->getParameter('routing_name_pattern')
        );

        if (null !== $entity) {
            $accessor = PropertyAccess::createPropertyAccessor();
            $actionConfiguration = $this->configurationFactory->createActionConfiguration(
                $actionName,
                $configuration->getParameter('actions')[$actionName],
                $view->getName(),
                $view->getAdminConfiguration()
            );

            foreach ($actionConfiguration->getParameter('route_requirements') as $name => $requirements) {
                $parameters[$name] = $accessor->getValue($entity, $name);
            }
        }

        return $this->router->generate($routeName, $parameters);
    }
public function getAdminUrl ( ViewInterface $ view , string $ actionName , $ entity = null ) { if ( ! $ this -> isAdminActionAllowed ( $ view , $ actionName ) ) { throw new Exception ( 'The action "' . $ actionName . '" is not allowed for the admin "' . $ view -> getName ( ) . '"' ) ; } $ configuration = $ view -> getAdminConfiguration ( ) ; $ parameters = [ ] ; $ routeName = RoutingLoader :: generateRouteName ( $ view -> getName ( ) , $ actionName , $ configuration -> getParameter ( 'routing_name_pattern' ) ) ; if ( null !== $ entity ) { $ accessor = PropertyAccess :: createPropertyAccessor ( ) ; $ actionConfiguration = $ this -> configurationFactory -> createActionConfiguration ( $ actionName , $ configuration -> getParameter ( 'actions' ) [ $ actionName ] , $ view -> getName ( ) , $ view -> getAdminConfiguration ( ) ) ; foreach ( $ actionConfiguration -> getParameter ( 'route_requirements' ) as $ name => $ requirements ) { $ parameters [ $ name ] = $ accessor -> getValue ( $ entity , $ name ) ; } } return $ this -> router -> generate ( $ routeName , $ parameters ) ; }
Return the url of an Admin action.

@param ViewInterface $view
@param string        $actionName
@param mixed|null    $entity

@return string

@throws Exception
Return the url of an Admin action .