Skip to content

Generated cache with varying argument service declaration #296

Closed
@ludovic-gonthier

Description

@ludovic-gonthier
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Version/Branch dev-master

We have an issue with what appear to be the generated cache:
We have 2 resolvers services that uses the same class with different constructor arguments and we have two different alias for the same method.

The issue is whatever alias we use, the only code executed is the one of first declared service.

Here is the service definition followed by the generated cache.

my_namespace.graphql.resolver.foo:
    class: My\Namespace\Resolver
    arguments:
        $varyingArgument: '@my_service_a'
    tags:
        - { name: overblog_graphql.resolver, method: resolveFunction, alias: resolver_foo }

my_namespace.graphql.resolver.bar:
    class: My\Namespace\Resolver
    arguments:
        $varyingArgument: '@my_service_b'
    tags:
        - { name: overblog_graphql.resolver, method: resolveFunction, alias: resolver_bar }

Generated cache:

$instance->addSolution(
    'My\\Namespace\\MyResolver::resolveFunction',
    array(
        0 => array(
            0 => $this,
            1 => 'get'
        ),
        1 => array(
            0 => 'my_namespace.graphql.resolver.foo'
        )
    ) ,
    array(
        0 => 'resolver_foo',
        1 => 'resolver_bar'
    ) ,
    array(
        'id' => 'fov_backend.graphql.resolver.content',
        'aliases' => array(
            0 => 'mezzo_content',
            1 => 'mezzo_product'
        ) ,
        'method' => 'resolveFunction',
        'alias' => 'resolver_foo'
    )
);

Example:

When we try to call resolver_bar it's the service my_namespace.graphql.resolver.foo::resolveFunction that is called instead of the wanted my_namespace.graphql.resolver.bar::resolveFunction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions