Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
hasDelta example
$this
->
getAppLifecycle
(
)
->
install
(
$manifest
, false,
$context
)
;
$criteria
=
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'name', 'test'
)
)
;
/** @var AppEntity $app */
$app
=
$this
->
getAppRepository
(
)
->
search
(
$criteria
,
$context
)
->
first
(
)
;
static
::
assertFalse
(
(
new
DomainsDeltaProvider
(
)
)
->
hasDelta
(
$manifest
,
$app
)
)
;
$app
->
setAllowedHosts
(
[
]
)
;
static
::
assertTrue
(
(
new
DomainsDeltaProvider
(
)
)
->
hasDelta
(
$manifest
,
$app
)
)
;
}
private
function
getAppLifecycle
(
)
: AppLifecycle
{
return
$this
->
getContainer
(
)
->
get
(
AppLifecycle::
class
)
;
}
$this
->
getAppLifecycle
(
)
->
install
(
$manifest
, false,
$context
)
;
$criteria
=
(
new
Criteria
(
)
)
->
addFilter
(
new
EqualsFilter
(
'name', 'test'
)
)
->
addAssociation
(
'acl_role'
)
;
/** @var AppEntity $app */
$app
=
$this
->
getAppRepository
(
)
->
search
(
$criteria
,
$context
)
->
first
(
)
;
$hasDelta
=
(
new
PermissionsDeltaProvider
(
)
)
->
hasDelta
(
$manifest
,
$app
)
;
static
::
assertFalse
(
$hasDelta
)
;
}
private
function
getAppLifecycle
(
)
: AppLifecycle
{
return
$this
->
getContainer
(
)
->
get
(
AppLifecycle::
class
)
;
}
private
function
getAppRepository
(
)
: EntityRepository
{
foreach
(
$this
->deltaProviders
as
$provider
)
{
$deltas
[
$provider
->
getDeltaName
(
)
]
=
$provider
->
getReport
(
$manifest
,
$app
)
;
}
return
$deltas
;
}
public
function
requiresRenewedConsent
(
Manifest
$manifest
, AppEntity
$app
)
: bool
{
foreach
(
$this
->deltaProviders
as
$provider
)
{
if
(
$provider
->
hasDelta
(
$manifest
,
$app
)
)
{
return
true;
}
}
return
false;
}
}