Avoid potential scope bug
This commit is contained in:
parent
4b280bef24
commit
2c2b9668d2
|
@ -562,15 +562,15 @@ App::post('/v1/functions/:functionId/deployments')
|
||||||
|
|
||||||
if ($activate) {
|
if ($activate) {
|
||||||
// Remove deploy for all other deployments.
|
// Remove deploy for all other deployments.
|
||||||
$deployments = $dbForProject->find('deployments', [
|
$activeDeployments = $dbForProject->find('deployments', [
|
||||||
new Query('activate', Query::TYPE_EQUAL, [true]),
|
new Query('activate', Query::TYPE_EQUAL, [true]),
|
||||||
new Query('resourceId', Query::TYPE_EQUAL, [$functionId]),
|
new Query('resourceId', Query::TYPE_EQUAL, [$functionId]),
|
||||||
new Query('resourceType', Query::TYPE_EQUAL, ['functions'])
|
new Query('resourceType', Query::TYPE_EQUAL, ['functions'])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($deployments as $deployment) {
|
foreach ($activeDeployments as $activeDeployment) {
|
||||||
$deployment->setAttribute('activate', false);
|
$activeDeployment->setAttribute('activate', false);
|
||||||
$dbForProject->updateDocument('deployments', $deployment->getId(), $deployment);
|
$dbForProject->updateDocument('deployments', $activeDeployment->getId(), $activeDeployment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue