Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AdminScope example
$isAdmin
=
$this
->connection->
createQueryBuilder
(
)
->
select
(
'admin'
)
->
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
)
{