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

AbstractDoctrineTypeDriver::normalizeFieldType() must be of the type string, null given #1015

Closed
dekamaru opened this issue Dec 4, 2018 · 1 comment
Labels

Comments

@dekamaru
Copy link

dekamaru commented Dec 4, 2018

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

I want serialize Entity with Embeddables and get this error.

Error throwed by type-hint value mismatch $doctrineMetadata->getTypeOfField() returns DoctrineType|string|null, but JMS normalizeFieldType (AbastractDoctrineTypeDriver.php) have protected function normalizeFieldType(string $type): ?string signature and error happens.

It was happened after upgrade from symfony 3 to symfony 4, and all bundles updates.
In SerializerBundle 2.3 version all working good, because there is doc-block usage instead type-hint

I think you need set nullable type-hint in normalizeFieldType function.

Steps required to reproduce the problem

  1. Serialize any Entity with Embedded property

Expected Result

  • Serialized entity

Actual Result

  • Argument 1 passed to JMS\Serializer\Metadata\Driver\AbstractDoctrineTypeDriver::normalizeFieldType() must be of the type string, null given
@goetas
Copy link
Collaborator

goetas commented Dec 9, 2018

fixed by #1020

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

No branches or pull requests

2 participants