Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setApiKey example
$user
=
$builder
->
getQuery
(
)
->
getOneOrNullResult
(
$this
->
getResultMode
(
)
)
;
if
(
!
$user
)
{
throw
new
NotFoundException
(
sprintf
(
'User by id %s not found',
$id
)
)
;
}
if
(
!
$this
->
hasPrivilege
(
'create', 'usermanager'
)
&& !
$this
->
hasPrivilege
(
'update', 'usermanager'
)
)
{
if
(
\
is_array
(
$user
)
)
{
unset
(
$user
[
'apiKey'
]
,
$user
[
'sessionId'
]
,
$user
[
'password'
]
,
$user
[
'encoder'
]
)
;
}
else
{
$user
->
setApiKey
(
''
)
;
$user
->
setSessionId
(
''
)
;
$user
->
setPassword
(
''
)
;
$user
->
setEncoder
(
''
)
;
}
}
return
$user
;
}
/** * Returns a list of user objects. * * @param int $offset * @param int $limit * * @return array */