Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated cache with varying argument service declaration #296

Closed
ludovic-gonthier opened this issue Feb 28, 2018 · 3 comments
Closed

Generated cache with varying argument service declaration #296

ludovic-gonthier opened this issue Feb 28, 2018 · 3 comments
Labels

Comments

@ludovic-gonthier
Copy link

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.

@mcg-web mcg-web added the bug label Feb 28, 2018
@mcg-web
Copy link
Member

mcg-web commented Feb 28, 2018

Thanks for reporting this bug, It seems to be releated to this commit 10b1660. I'll try to fix this today 👍

@ludovic-gonthier
Copy link
Author

Thanks for the quick response. Let me know if i can lend a hand with fixing this issue

@mcg-web
Copy link
Member

mcg-web commented Mar 5, 2018

Fixed, now directly use the service id as prefix: my_namespace.graphql.resolver.foo::resolveFunction or my_namespace.graphql.resolver.bar::resolveFunction.

@mcg-web mcg-web closed this as completed Mar 5, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants