fix jms metadata parser for hashmaps: array<K, V>

This commit is contained in:
Tobias Schultze 2013-05-10 19:09:57 +02:00
parent 00bcdc927e
commit d2cd56dafc

View File

@ -181,13 +181,16 @@ class JmsMetadataParser implements ParserInterface
*/
protected function getNestedTypeInArray(PropertyMetadata $item)
{
if (is_array($item->type)
&& in_array($item->type['name'], array('array', 'ArrayCollection'))
&& isset($item->type['params'])
&& 1 === count($item->type['params'])
&& isset($item->type['params'][0]['name'])) {
if (isset($item->type['name']) && in_array($item->type['name'], array('array', 'ArrayCollection'))) {
if (isset($item->type['params'][1]['name'])) {
// E.g. array<string, MyNamespaceMyObject>
return $item->type['params'][1]['name'];
}
if (isset($item->type['params'][0]['name'])) {
// E.g. array<MyNamespaceMyObject>
return $item->type['params'][0]['name'];
}
}
return null;
}