Skip to content

Doctrine Collections should be an array #37041

@Gemorroj

Description

@Gemorroj

Symfony version(s) affected: 4.4.9

Description
After this change #36601 empty Doctrine Collections became objects instead of empty arrays

How to reproduce

use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Serializer;

$serializer = new Serializer([], [new JsonEncoder()]);
$arr = new ArrayCollection();

echo $serializer->serialize($arr, 'json');

// 4.4.8 - []
// 4.4.9 - {}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions