-
Notifications
You must be signed in to change notification settings - Fork 95
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
Add a @InjectUser annotation #131
Comments
I think its a bad idea, its adding complexity for nothing, instead use DI. class MyQuery
{
private $session;
public function __construct(Session $session)
{
$this->session = $session;
}
/** @Query */
public function getUser(): string
{
return $this->session->getUser()->getName();
}
} If you go this way, the graphqlite is going to turn into DIC, i think it's not design in this way. |
Hi @moufmouf, is this the last issue needed for v4? I'm really interested in this project since i want to bundle into my laravel 6 application. Is there any estimate on when the v4 will be available? Thank you for your amazing work! |
@XPOL555 don’t hesitate to use the « dev-master » version: it is really stable ;) |
@XPOL555 I cannot really give you an estimate for v4 release but it is definitely soon (probably in November). I only plan to fix #103, implement this feature and add a way to add a GraphQL field directly on a magic property (that could be useful to ease the integration with Eloquent) |
@fezfez I still gave this a try (see #202). I understand that you can clearly inject the "session" in your constructor and fetch the current user this way, but this is framework specific. And GraphQLite is framework agnostic. I envision the possibility to create third party packages that would contain queries / mutations that could be used in any framework. Adding this |
Idea: add a @InjectUser annotation that allows injecting the current user in any query / mutation / field.
The text was updated successfully, but these errors were encountered: