Skip to content

CsvEncoder does not consider context #23278

@SmokeyBrandie

Description

@SmokeyBrandie
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.2.4

CsvEncoder class seems to not consider context.
This leads to "circular reference" error on encoding since Groups Annotaton are not processed.

Example:

$serializer = new Serializer([new ObjectNormalizer()], [new CsvEncoder()]);
$data = $serializer->encode($items, 'csv', array('groups' => array('export')));

The entitiy has only one field with the annotation "groups":

/**
 * @var string
 *
 * @ORM\Column(name="title", type="string", length=255)
 * @Groups({"export"})
 * @Assert\NotNull()  
 */
private $title;

As far as I can see, the CsvEncoder Class Symfony\Component\Serializer\Encoder\CsvEncoder does not consider the $context at all.

Even though the method public function encode($data, $format, array $context = array()) defines it, $context is nowhere used in the method.

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