Skip to content

symfony profiler + subresource breakage on 2.6.0 #3976

Description

@yivi

API Platform version(s) affected: 2.6.0

Description
With the profiler enabled, queries to subresources break, and the profiler information is not saved (a profiler token is generated, but the data is lost.

How to reproduce
Minimal repo demonstrating the issue here:
https://github.com/yivi/api-platform-bug-subresource-profiler

composer create-project symfony/skeleton project
cd project
composer req api
composer req profiler

Created two basic Book and Author entities, with Book -> ManyToOne -> Author, and Author::books marked as subresource:

    /**
     * @ORM\OneToMany(targetEntity=Book::class, mappedBy="author")
     * @ApiSubresource
     */
    private $books;

Trying:

curl -X GET "http://localhost:9898/api/authors/1/books?page=1" -H  "accept: application/ld+json"

I get:
error.log

Possible Solution
Sadly I have no clue. I'll try to dig more tomorrow.

Additional Context
Found out about this mostly because I saw that the profiler data was being disappearing from some requests, which seemed very strange. Going back to 2.5.9 everything works as it should.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions