Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ protected function getAllowedAttributes($classOrObject, array $context, bool $at
// If you update this check, update accordingly the one in Symfony\Component\PropertyInfo\Extractor\SerializerExtractor::getProperties()
if (
!$ignore &&
(false === $groups || array_intersect($attributeMetadata->getGroups(), $groups)) &&
(false === $groups || array_intersect(array_merge($attributeMetadata->getGroups(), ['*']), $groups)) &&
$this->isAllowedAttribute($classOrObject, $name = $attributeMetadata->getName(), null, $context)
) {
$allowedAttributes[] = $attributesAsString ? $name : $attributeMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ public function testGetAllowedAttributesAsString()

$result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['other']], true);
$this->assertEquals(['a3', 'a4'], $result);

$result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['*']], true);
$this->assertEquals(['a1', 'a2', 'a3', 'a4'], $result);
}

public function testGetAllowedAttributesAsObjects()
Expand Down Expand Up @@ -104,6 +107,9 @@ public function testGetAllowedAttributesAsObjects()

$result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['other']], false);
$this->assertEquals([$a3, $a4], $result);

$result = $this->normalizer->getAllowedAttributes('c', [AbstractNormalizer::GROUPS => ['*']], false);
$this->assertEquals([$a1, $a2, $a3, $a4], $result);
}

public function testObjectWithStaticConstructor()
Expand Down