Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setForeignKey example
private
function
generateUrls
(
SeoUrlRouteInterface
$seoUrlRoute
, SeoUrlRouteConfig
$config
, SalesChannelEntity
$salesChannel
, EntityCollection
$entities
)
: iterable
{
$request
=
$this
->requestStack->
getMainRequest
(
)
;
$basePath
=
$request
?
$request
->
getBasePath
(
)
: '';
foreach
(
$entities
as
$entity
)
{
$seoUrl
=
new
SeoUrlEntity
(
)
;
$seoUrl
->
setForeignKey
(
$entity
->
getUniqueIdentifier
(
)
)
;
$seoUrl
->
setIsCanonical
(
true
)
;
$seoUrl
->
setIsModified
(
false
)
;
$seoUrl
->
setIsDeleted
(
false
)
;
$copy
=
clone
$seoUrl
;
$mapping
=
$seoUrlRoute
->
getMapping
(
$entity
,
$salesChannel
)
;
$copy
->
setError
(
$mapping
->
getError
(
)
)
;
$pathInfo
=
$this
->router->
generate
(
$config
->
getRouteName
(
)
,
$mapping
->
getInfoPathContext
(
)
)
;