Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
findByDefinition example
$this
->
findStruct
(
$data
,
$item
)
;
}
}
}
private
function
enrich
(
SeoResolverData
$data
, SalesChannelContext
$context
)
: void
{
foreach
(
$data
->
getEntities
(
)
as
$definition
)
{
$definition
=
(string)
$definition
;
$ids
=
$data
->
getIds
(
$definition
)
;
$routes
=
$this
->seoUrlRouteRegistry->
findByDefinition
(
$definition
)
;
if
(
\
count
(
$routes
)
=== 0
)
{
continue
;
}
$routes
=
array_map
(
static
fn
(
SeoUrlRouteConfigRoute
$seoUrlRoute
)
=>
$seoUrlRoute
->
getConfig
(
)
->
getRouteName
(
)
,
$routes
)
;
$criteria
=
new
Criteria
(
)
;
$criteria
->
addFilter
(
new
EqualsFilter
(
'isCanonical', true
)
)
;
$criteria
->
addFilter
(
new
EqualsAnyFilter
(
'routeName',
$routes
)
)
;
$criteria
->
addFilter
(
new
EqualsAnyFilter
(
'foreignKey',
$ids
)
)
;
$criteria
->
addFilter
(
new
EqualsFilter
(
'languageId',
$context
->
getContext
(
)
->
getLanguageId
(
)
)
)
;