Skip to content

Possible conflict between subresource collection and nested subresource collection #1107

Description

@teohhanhui

Given Tour -[:offers]-> AggregateOffer -[:offers]-> Offer

GET /app_dev.php/aggregate_offers/8339/offers.jsonld failed with:

[1] ApiPlatform\Core\Exception\InvalidArgumentException: Unable to generate an IRI for "AppBundle\Entity\Offer".
    at n/a
        in /srv/tripviss-api/vendor/api-platform/core/src/Bridge/Symfony/Routing/IriConverter.php line 133

    at ApiPlatform\Core\Bridge\Symfony\Routing\IriConverter->getSubresourceIriFromResourceClass('AppBundle\\Entity\\Offer', array('id' => '8339'))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/CollectionNormalizer.php line 79

    at ApiPlatform\Core\Hydra\Serializer\CollectionNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339')), 'jsonld_has_context' => true, 'api_sub_level' => true))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/PartialCollectionViewNormalizer.php line 48

    at ApiPlatform\Core\Hydra\Serializer\PartialCollectionViewNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/CollectionFiltersNormalizer.php line 59

    at ApiPlatform\Core\Hydra\Serializer\CollectionFiltersNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php line 142

    at Symfony\Component\Serializer\Serializer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php line 115

    at Symfony\Component\Serializer\Serializer->serialize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/api-platform/core/src/EventListener/SerializeListener.php line 64

(truncated)

[2] Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("offers") to generate a URL for route "api_tours_offers_offers_get_subresource".
    at n/a
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGenerator.php line 151

    at Symfony\Component\Routing\Generator\UrlGenerator->doGenerate(array('id' => 0, 'offers' => 1, '_format' => 2), array('_controller' => 'api_platform.action.get_subresource', '_format' => null, '_api_resource_class' => 'AppBundle\\Entity\\Offer', '_api_subresource_operation_name' => 'get_subresource_offers', '_api_subresource_context' => array('property' => 'offers', 'identifiers' => array(array('id', 'AppBundle\\Entity\\Tour'), array('offers', 'AppBundle\\Entity\\AggregateOffer')), 'collection' => true)), array(), array(array('variable', '.', '[^/]++', '_format'), array('text', '/offers'), array('variable', '/', '[^/]++', 'offers'), array('text', '/offers'), array('variable', '/', '[^/]++', 'id'), array('text', '/tours')), array('id' => '8339'), 'api_tours_offers_offers_get_subresource', 1, array(), array())
        in /srv/tripviss-api/var/cache/dev/appDevDebugProjectContainerUrlGenerator.php line 328

    at appDevDebugProjectContainerUrlGenerator->generate('api_tours_offers_offers_get_subresource', array('id' => '8339'), 1)
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Routing/Router.php line 244

    at Symfony\Component\Routing\Router->generate('api_tours_offers_offers_get_subresource', array('id' => '8339'), 1)
        in /srv/tripviss-api/vendor/api-platform/core/src/Bridge/Symfony/Routing/Router.php line 93

    at ApiPlatform\Core\Bridge\Symfony\Routing\Router->generate('api_tours_offers_offers_get_subresource', array('id' => '8339'), 1)
        in /srv/tripviss-api/vendor/api-platform/core/src/Bridge/Symfony/Routing/IriConverter.php line 131

    at ApiPlatform\Core\Bridge\Symfony\Routing\IriConverter->getSubresourceIriFromResourceClass('AppBundle\\Entity\\Offer', array('id' => '8339'))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/CollectionNormalizer.php line 79

    at ApiPlatform\Core\Hydra\Serializer\CollectionNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339')), 'jsonld_has_context' => true, 'api_sub_level' => true))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/PartialCollectionViewNormalizer.php line 48

    at ApiPlatform\Core\Hydra\Serializer\PartialCollectionViewNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/api-platform/core/src/Hydra/Serializer/CollectionFiltersNormalizer.php line 59

    at ApiPlatform\Core\Hydra\Serializer\CollectionFiltersNormalizer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php line 142

    at Symfony\Component\Serializer\Serializer->normalize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php line 115

    at Symfony\Component\Serializer\Serializer->serialize(object(Paginator), 'jsonld', array('groups' => array('offer_read'), 'subresource_operation_name' => 'get_subresource_offers', 'operation_type' => 'subresource', 'resource_class' => 'AppBundle\\Entity\\Offer', 'request_uri' => '/app_dev.php/aggregate_offers/8339/offers.jsonld', 'subresource_identifiers' => array('id' => '8339'), 'subresource_resources' => array('AppBundle\Entity\AggregateOffer' => array('id' => '8339'))))
        in /srv/tripviss-api/vendor/api-platform/core/src/EventListener/SerializeListener.php line 64

(truncated)

But GET /app_dev.php/tours/2945/offers/8339/offers.jsonld is successful.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions