Skip to content

Commit d6e38f2

Browse files
dunglasfabpot
authored andcommitted
[Serializer] Ensure that groups are strings
1 parent 7f755cd commit d6e38f2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Mapping/Loader/YamlFileLoader.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)
7474
}
7575

7676
if (isset($data['groups'])) {
77+
if (!is_array($data['groups'])) {
78+
throw new MappingException('The "groups" key must be an array of strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName());
79+
}
80+
7781
foreach ($data['groups'] as $group) {
82+
if (!is_string($group)) {
83+
throw new MappingException('Group names must be strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName());
84+
}
85+
7886
$attributeMetadata->addGroup($group);
7987
}
8088
}

0 commit comments

Comments
 (0)