You are a developer and looking for Shopware projects?
Apply Now!
getControllerKey example
$this
->_module =
strtolower
(
trim
(
$value
)
)
;
return
$this
;
}
/** * {@inheritdoc} */
public
function
getControllerName
(
)
{
if
(
$this
->_controller === null
)
{
$this
->_controller =
$this
->
getNameFormatter
(
)
->
formatNameForRequest
(
$this
->
getParam
(
$this
->
getControllerKey
(
)
)
, true
)
;
}
return
$this
->_controller;
}
/** * {@inheritdoc} */
public
function
setControllerName
(
$value
)
{
$this
->_controller =
$value
;
public
function
generate
(
array
$params
, Context
$context
)
{
$route
=
[
]
;
if
(
\
array_key_exists
(
'_seo',
$params
)
)
{
unset
(
$params
[
'_seo'
]
)
;
}
$module
=
$params
[
$context
->
getModuleKey
(
)
]
??
$this
->dispatcher->
getDefaultModule
(
)
;
$controller
=
$params
[
$context
->
getControllerKey
(
)
]
??
$this
->dispatcher->
getDefaultControllerName
(
)
;
$action
=
$params
[
$context
->
getActionKey
(
)
]
??
$this
->dispatcher->
getDefaultAction
(
)
;
unset
(
$params
[
$context
->
getModuleKey
(
)
]
,
$params
[
$context
->
getControllerKey
(
)
]
,
$params
[
$context
->
getActionKey
(
)
]
)
;
if
(
$module
!==
$this
->dispatcher->
getDefaultModule
(
)
)
{
$route
[
]
=
$module
;
}
$paramCount
= \
count
(
$params
)
;
if
(
empty
(
$path
)
)
{
return
false;
}
$query
=
[
]
;
$params
=
[
]
;
foreach
(
explode
(
$this
->separator,
$path
)
as
$i
=>
$routePart
)
{
$routePart
=
urldecode
(
$routePart
)
;
if
(
$i
=== 0 &&
empty
(
$query
[
$context
->
getModuleKey
(
)
]
)
&&
$this
->dispatcher->
isValidModule
(
$routePart
)
)
{
$query
[
$context
->
getModuleKey
(
)
]
=
$routePart
;
}
elseif
(
empty
(
$query
[
$context
->
getControllerKey
(
)
]
)
)
{
$query
[
$context
->
getControllerKey
(
)
]
=
$routePart
;
}
elseif
(
empty
(
$query
[
$context
->
getActionKey
(
)
]
)
)
{
$query
[
$context
->
getActionKey
(
)
]
=
$routePart
;
}
else
{
$params
[
]
=
$routePart
;
}
}
if
(
$params
)
{
$chunks
=
array_chunk
(
$params
, 2, false
)
;
foreach
(
$chunks
as
$chunk
)
{