Documentation

Context

Constants


This service is a data storage within execution context.

When context is global, you can access to it from container.

When context is one of method arguments, it can be passed there, by generating it directly.

When it's not passed, always sources global context.

Types of launching methods are stored in class constants.

  • public const SCOPE_MANUAL = 'manual' - manual launch (default value);
  • public const SCOPE_TASK = 'task' - launch from task;
  • public const SCOPE_AUTOMATION = 'automation' - launch from workflow automation rule/workflow;
  • public const SCOPE_REST = 'rest' - launch from the application.

Methods

Method Description Available from version
public function setUserId(int $userId): Context
Sets user $userId.
public function getUserId(): int
Returns user ID. When it's not set, returns current authorized user ID.
If user isn't initialized at the moment of method call, method returns 0.
public function setScope(string $scope): Context
Sets method for launching the context $scope.
public function getScope(): string
Returns launch method. If not set, returns manual.
© «Bitrix24», 2001-2024