Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
uniqueScopes example
->
from
(
'user'
)
->
where
(
'id = UNHEX(:accessKey)'
)
->
setParameter
(
'accessKey',
$userIdentifier
)
->
setMaxResults
(
1
)
->
executeQuery
(
)
->
fetchOne
(
)
;
if
(
$isAdmin
)
{
$scopes
[
]
=
new
AdminScope
(
)
;
}
return
$this
->
uniqueScopes
(
$scopes
)
;
}
private
function
uniqueScopes
(
array
$scopes
)
: array
{
$uniqueScopes
=
[
]
;
/** @var ScopeEntityInterface $scope */
foreach
(
$scopes
as
$scope
)
{
$uniqueScopes
[
$scope
->
getIdentifier
(
)
]
=
$scope
;
}