Skip to content

[FIX] Fix normalizer error #525

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

Merged
merged 3 commits into from
Jun 6, 2022
Merged

[FIX] Fix normalizer error #525

merged 3 commits into from
Jun 6, 2022

Conversation

DocentBF
Copy link
Contributor

Got an error
Symfony\Component\Serializer\Exception\LogicException [ 0 ]: Cannot normalize attribute "phones" because the injected serializer is not a normalizer. ~ /vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php [ 209 ]
when use \LaravelDoctrine\ORM\Serializers\Arrayable::toArray() method on entity with json-typed property:

class Region 
{
    /**
     * @ORM\Column(name="phones", type="json")
     */
    protected $phones = [];
}

Changes proposed in this pull request:

ArraySerializer: non-direct normalizer call.

@DocentBF DocentBF changed the title Fix normalizer error [FIX] Fix normalizer error May 31, 2022
@DocentBF
Copy link
Contributor Author

DocentBF commented Jun 6, 2022

Sorry, I forgot the Serializer import. Fixed.

@eigan
Copy link
Member

eigan commented Jun 6, 2022

Thank you @DocentBF. Could you provide a failing testcase? You could add it to ArraySerializerTest

@DocentBF
Copy link
Contributor Author

DocentBF commented Jun 6, 2022

@eigan done.

@eigan
Copy link
Member

eigan commented Jun 6, 2022

Looks good! 👍🏻 Thanks!

@eigan eigan merged commit 4cbd87c into laravel-doctrine:1.7 Jun 6, 2022
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

Successfully merging this pull request may close these issues.

2 participants