private readonly EntityRepository
$appRepository ) { } public function updateConditions(Manifest
$manifest, string
$appId, string
$defaultLocale, Context
$context): void
{ $app =
$this->
getAppWithExistingConditions($appId,
$context);
/** @var AppScriptConditionCollection $existingRuleConditions */
$existingRuleConditions =
$app->
getScriptConditions();
$ruleConditions =
$manifest->
getRuleConditions();
$ruleConditions =
$ruleConditions !== null ?
$ruleConditions->
getRuleConditions() :
[];
$upserts =
[];
foreach ($ruleConditions as $ruleCondition) { $payload =
$ruleCondition->
toArray($defaultLocale);
$payload['identifier'
] =
sprintf('app\\%s_%s',
$manifest->
getMetadata()->
getName(),
$ruleCondition->
getIdentifier());
$payload['script'
] =
$this->scriptReader->
getScriptContent( self::CONDITION_SCRIPT_DIR .
$ruleCondition->
getScript(),
$app->
getPath() );