Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
fetchUserStoreToken example
}
private
function
getTokenFromAdmin
(
Context
$context
)
: ?string
{
$contextSource
=
$this
->
ensureAdminApiSource
(
$context
)
;
$userId
=
$contextSource
->
getUserId
(
)
;
if
(
$userId
=== null
)
{
throw
new
InvalidContextSourceUserException
(
$contextSource
::
class
)
;
}
return
$this
->
fetchUserStoreToken
(
new
Criteria
(
[
$userId
]
)
,
$context
)
;
}
private
function
getTokenFromSystem
(
Context
$context
)
: ?string
{
$contextSource
=
$context
->
getSource
(
)
;
if
(
!
(
$contextSource
instanceof SystemSource
)
)
{
throw
new
InvalidContextSourceException
(
SystemSource::
class
,
$contextSource
::
class
)
;
}
$criteria
=
new
Criteria
(
)
;
$criteria
->
addFilter
(