Skip to content

Commit d099dd6

Browse files
fix(symfony): upgrade command removes filters (#4970)
1 parent c037806 commit d099dd6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/Core/Upgrade/UpgradeApiFilterVisitor.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public function enterNode(Node $node)
147147
$reflection = $this->reflectionClass->getProperty($node->props[0]->name->__toString());
148148
}
149149

150+
$filterAttributes = [];
150151
foreach ($this->readApiFilters($reflection) as $annotation) {
151152
[$filterAnnotation, $isAnnotation] = $annotation;
152153
if ($isAnnotation) {
@@ -172,12 +173,14 @@ public function enterNode(Node $node)
172173
$arguments[$key] = $this->valueToNode($value);
173174
}
174175

175-
$node->attrGroups[] = new Node\AttributeGroup([
176-
new Node\Attribute(
177-
new Node\Name('ApiFilter'),
178-
$this->arrayToArguments($arguments),
179-
),
180-
]);
176+
$filterAttributes[] = new Node\Attribute(
177+
new Node\Name('ApiFilter'),
178+
$this->arrayToArguments($arguments),
179+
);
180+
}
181+
182+
foreach ($filterAttributes as $filterAttribute) {
183+
$node->attrGroups[] = new Node\AttributeGroup([$filterAttribute]);
181184
}
182185
}
183186
}

0 commit comments

Comments
 (0)