Skip to content

Bundle doesn't work with batch/subrequests #61

@sboesch

Description

@sboesch

We wanted to create a /batch route by using the HttpKernel:

foreach($requests as $request) {
    // ...
    $req = Request::create(
        $request['relative_url'],
        $request['method'],
        $options
    );
    $response = $kernel->handle($req);
}

However, since the ResourceCollection service (and probably others like JsonApi) sets the request on construction, it doesn't work with follow up requests:

/**
 * ResourceCollection constructor.
 */
public function __construct(RequestStack $requestStack, FinderCollection $finderCollection, Paginator $paginator, FieldManager $fieldManager)
{
    $this->request = $requestStack->getCurrentRequest();
    // ...
}

It will handle the same request over and over again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions