0 follower

Final Class Yiisoft\Yii\DataView\YiiRouter\UrlCreator

InheritanceYiisoft\Yii\DataView\YiiRouter\UrlCreator

URL creator for list views that generates URLs based on the current route.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Creates a new URL creator instance. Yiisoft\Yii\DataView\YiiRouter\UrlCreator
__invoke() Generates a URL based on the current route with modified parameters. Yiisoft\Yii\DataView\YiiRouter\UrlCreator

Method Details

Hide inherited methods

__construct() public method

Creates a new URL creator instance.

public __construct( \Yiisoft\Router\UrlGeneratorInterface $urlGenerator ): mixed
$urlGenerator \Yiisoft\Router\UrlGeneratorInterface

The URL generator service used to generate URLs from the current route.

                public function __construct(
    private readonly UrlGeneratorInterface $urlGenerator,
) {}

            
__invoke() public method

Generates a URL based on the current route with modified parameters.

public __invoke( array $arguments, array $queryParameters ): string
$arguments array

Route arguments to override in the current route.

$queryParameters array

Query parameters to append to the URL.

return string

The generated URL with the specified modifications.

                public function __invoke(array $arguments, array $queryParameters): string
{
    return $this->urlGenerator->generateFromCurrent($arguments, $queryParameters);
}