Closed emil-nasso closed 4 years ago
Will this break implementations relying on the current default value? It might be worth adding test cases that describes the old and new behaviour :)
Will this break implementations relying on the current default value? It might be worth adding test cases that describes the old and new behaviour :)
It can definitely break existing implementations, yes. If someone added a $app->when('\App\Something\Something')->needs(..)->give(..)
it would work before this patch but not after.
It's kind of an laravel detail that is the issue, not sure how we could add test-cases for that... Will have to think about that one..... :)
❤️
Will this break implementations relying on the current default value? It might be worth adding test cases that describes the old and new behaviour :)
It can definitely break existing implementations, yes. If someone added a
$app->when('\App\Something\Something')->needs(..)->give(..)
it would work before this patch but not after.It's kind of an laravel detail that is the issue, not sure how we could add test-cases for that... Will have to think about that one..... :)
❤️
It can break if you manually have registered \App\...
in your container AND you use the default butler-guru configuration. If you still have the "\\App\\..."
in your config it should still work.
@emil-nasso this PR should also update the README and CHANGELOG
The value of the
BUTLER_GRAPHQL_NAMESPACE
environment variable is used when resolving graphql queries, mutations and types.The default value for this namespace is prefixed by
\\
. When this library resolves a query from the container it resolves object with the\
prefix included. The problem arises when you try to bind or resolve something in the container usingExampleQuery::class
as this does not use\
as a prefix.Example: The namespace in our config is
\App\Http\Graphql
and we are trying to resolve theExample
query. This library will resolve\App\Http\Graphql\Example
in the container. We need to inject a specific instance of a class to the constructor of the query so we declare the following:Example::class
will expand toApp\Http\Graphql\Example
. Because this doesn't match\App\Http\Graphql\Example
, the binding won't work.This commit changes the default namespace in the config to use the standard format in php.