public
|
#
__construct( string|array $patternOrConfig = NULL, string $module = NULL, string $namespace = NULL, array $defaults = [], array $constraints = [], array $advancedConfiguration = [] )
Create new module domain route instance. First argument could be
configuration array with all necessary constructor values or all
separated arguments - first is route pattern value to parse into match
and reverse values, then module name, optional target controllers
namespace, params default values and constraints.
Example:
new \MvcCore\Ext\Routers\Modules\Route([
"pattern" => "//blog.%sld%.%tld%",
"module" => "blog",
"namespace" => "Blog",
"defaults" => ["page" => 1],
"constraints" => ["page" => "\d+"],
"allowedLocalizations" => ["en-US"],
"allowedMediaVersions" => ["full" => ""]
]);
or:
new \MvcCore\Ext\Routers\Modules\Route(
"//blog.%sld%.%tld%",
"blog", "Blog",
["page" => 1], ["page" => "\d+"],
[
"allowedLocalizations" => ["en-US"],
"allowedMediaVersions" => ["full" => ""]
]
);
or:
new \MvcCore\Ext\Routers\Modules\Route([
"match" => "#^//blog\.%sld%\.%tld%$#",
"reverse" => "//blog.%sld%.%tld%",
"module" => "blog",
"namespace" => "Blog",
"defaults" => ["page" => 1],
"constraints" => ["page" => "\d+"],
"allowedLocalizations" => ["en-US"],
"allowedMediaVersions" => ["full" => ""]
]);
Create new module domain route instance. First argument could be
configuration array with all necessary constructor values or all
separated arguments - first is route pattern value to parse into match
and reverse values, then module name, optional target controllers
namespace, params default values and constraints.
Example:
new \MvcCore\Ext\Routers\Modules\Route([ "pattern" => "//blog.%sld%.%tld%", "module" => "blog", "namespace" => "Blog", "defaults" => ["page" => 1], "constraints" => ["page" => "\d+"], "allowedLocalizations" => ["en-US"], "allowedMediaVersions" => ["full" => ""]
]);
or:
new \MvcCore\Ext\Routers\Modules\Route( "//blog.%sld%.%tld%", "blog", "Blog", ["page" => 1], ["page" => "\d+"], [ "allowedLocalizations" => ["en-US"], "allowedMediaVersions" => ["full" => ""] ]
);
or:
new \MvcCore\Ext\Routers\Modules\Route([ "match" => "#^//blog\.%sld%\.%tld%$#", "reverse" => "//blog.%sld%.%tld%", "module" => "blog", "namespace" => "Blog", "defaults" => ["page" => 1], "constraints" => ["page" => "\d+"], "allowedLocalizations" => ["en-US"], "allowedMediaVersions" => ["full" => ""]
]);
Parameters
- $patternOrConfig
Required, configuration array or route pattern value
to parse into match and reverse patterns.
- $module
Required, application module name. Equivalent for
classic route name.
- $namespace
Optional, target controllers namespace, applied to
routed controller by classic route if target
controller is not defined absolutely.
- $defaults
Optional, default param values like:
["name" => "default-name", "page" => 1] .
- $constraints
Optional, params regular expression constraints for
regular expression match function if no "match"
property in config array as first argument defined.
- $advancedConfiguration
Optional, http method to only match requests by this
method. If NULL (by default), request with any http
method could be matched by this route. Given value is
automatically converted to upper case.
|