Log in
Interface

ContextInterface

Magento\GraphQl\Model\Query\ContextInterface

What it does

This interface defines the context object that is passed to all GraphQL field resolvers in Magento 2.

Developers use it to access shared information like the current user's ID and type, as well as custom extension attributes throughout the GraphQL resolution process.

It serves as a central data container that eliminates the need to repeatedly fetch user data in each resolver.

Public Methods

  • getUserType()
  • getUserId()
  • getExtensionAttributes()