setId($data['id']); } if (isset($data['type'])) { $this->setId($data['type']); } $this->userContext = $userContext; } /** * {@inheritdoc} * * @return \Magento\Framework\GraphQl\Query\Resolver\ContextExtensionInterface */ public function getExtensionAttributes() : \Magento\Framework\GraphQl\Query\Resolver\ContextExtensionInterface { return $this->_getExtensionAttributes(); } /** * {@inheritdoc} * * @param \Magento\Framework\GraphQl\Query\Resolver\ContextExtensionInterface $extensionAttributes * @return ContextInterface */ public function setExtensionAttributes( \Magento\Framework\GraphQl\Query\Resolver\ContextExtensionInterface $extensionAttributes ) : ContextInterface { return $this->_setExtensionAttributes($extensionAttributes); } /** * @inheritDoc */ public function getUserId() : int { if (!$this->getData(self::USER_ID)) { $this->setUserId((int) $this->userContext->getUserId()); } return (int) $this->getData(self::USER_ID); } /** * @inheritDoc */ public function setUserId(int $userId) : ContextInterface { return $this->setData(self::USER_ID, $userId); } /** * @inheritDoc */ public function getUserType() : int { if (!$this->getData(self::USER_TYPE_ID)) { $this->setUserType($this->userContext->getUserType()); } return (int) $this->getData(self::USER_TYPE_ID); } /** * @inheritDoc */ public function setUserType(int $typeId) : ContextInterface { return $this->setData(self::USER_TYPE_ID, $typeId); } }