Merge pull request #192 from Tobion/patch-1

fix jms metadata parser for hashmaps: array<K, V>
This commit is contained in:
Jordi Boggiano 2013-05-11 03:33:45 -07:00
commit 806e009391

View File

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