Skip to content

Doctrine CollectionDataProvider does not honor CollectionDataProviderInterface::getCollection contract #1047

@fbourigault

Description

@fbourigault

When null is used as second argument of ApiPlatform\Core\Bridge\Doctrine\Orm\CollectionDataProvider::getCollection, the ApiPlatform\Core\Bridge\Doctrine\Orm\Extension\FilterExtension::applyToCollection doesn't handle the exception thrown by ApiPlatform\\Core\\Metadata\\Resource\\ResourceMetadata::getCollectionOperationAttribute().

Exception message:

Argument 1 passed to ApiPlatform\\Core\\Metadata\\Resource\\ResourceMetadata::getCollectionOperationAttribute() must be of the type string, null given, called in /home/httpd/api-platform/demo/vendor/api-platform/core/src/Bridge/Doctrine/Orm/Extension/FilterExtension.php on line 43

I hit this bug while writing my GraphQL POC. I'm calling the ChainCollectionDataProvider like this:

$this->collectionDataProvider->getCollection($resourceName);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions