Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"array" type: Not working for arrays of DateTime objects #343

Closed
lukey78 opened this issue Dec 5, 2013 · 1 comment
Closed

"array" type: Not working for arrays of DateTime objects #343

lukey78 opened this issue Dec 5, 2013 · 1 comment

Comments

@lukey78
Copy link

lukey78 commented Dec 5, 2013

I recently tried to use the following annotation that should work as documented:

@JMS\Type("array<DateTime<'Y-m-d'>>")

But it doesn't. The DateTimes are serialized to empty strings.

While investigating the problem I found that line in the visitArray function of (e.g.) the GenericSerializationVisitor:

   $v = $this->navigator->accept($v, isset($type['params'][1]) ? $type['params'][1] : null, $context);

$type['params'][1] normally doesn't exist. The accept function is called with a null type which results in auto detection of the type.

If I change the $type['params'][1] to $type['params'][0] everything seems to work as expected.

Is this a bug or a feature? I could also submit a pull request if this is a bug.

Thanks,
Jens

@lukey78
Copy link
Author

lukey78 commented Dec 5, 2013

Sorry, moved to schmittjoh/serializer#199

@lukey78 lukey78 closed this as completed Dec 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant