Skip to content

Commit

Permalink
[Serializer] Ensure that groups are strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas authored and fabpot committed Jan 26, 2016
1 parent 31aef7b commit 0a3b877
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -74,7 +74,15 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata)
}

if (isset($data['groups'])) {
if (!is_array($data['groups'])) {
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());
}

foreach ($data['groups'] as $group) {
if (!is_string($group)) {
throw new MappingException('Group names must be strings in "%s" for the attribute "%s" of the class "%s".', $this->file, $attribute, $classMetadata->getName());
}

$attributeMetadata->addGroup($group);
}
}
Expand Down

0 comments on commit 0a3b877

Please sign in to comment.