Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
AppByNameNotFoundException example
public
function
runAction
(
RequestDataBag
$requestDataBag
, Context
$context
)
: Response
{
$appName
=
$requestDataBag
->
get
(
'appName'
)
;
$criteria
=
new
Criteria
(
)
;
$criteria
->
addFilter
(
new
EqualsFilter
(
'name',
$appName
)
)
;
/** @var AppEntity|null $app */
$app
=
$this
->appRepository->
search
(
$criteria
,
$context
)
->
first
(
)
;
if
(
$app
=== null
)
{
throw
new
AppByNameNotFoundException
(
$appName
)
;
}
$shopUrl
= EnvironmentHelper::
getVariable
(
'APP_URL'
)
;
if
(
!\
is_string
(
$shopUrl
)
)
{
throw
new
MissingShopUrlException
(
)
;
}
$appSecret
=
$app
->
getAppSecret
(
)
;
if
(
$appSecret
=== null
)
{
throw
new
MissingAppSecretException
(
)
;
}