Skip to content

Doctrine ORM ItemProvider does not allow array result (mixed query result) #7084

@rdavaillaud

Description

@rdavaillaud

API Platform version(s) affected: 4.1

Description

It is not possible to return a mixed result (array with object and scalar) in the Doctrine Orm ItemProvider.
The current signature allow only null or object to be returned.

public function provide(Operation $operation, array $uriVariables = [], array $context = []): ?object

How to reproduce
Add to the queryBuilder a scalar value to select along the entity in order to make Doctrine return a mixed result.

Possible Solution
Change the return signature like the following.

public function provide(Operation $operation, array $uriVariables = [], array $context = []): null|array|object

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions