Request

Type
Class
Namespace
craft\console
Inherits
craft\console\Request » yii\console\Request » yii\base\Request » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Uses traits
craft\base\RequestTrait
Since
3.0.0

View source

# Public Properties

Property Description
behaviors yii\base\Behavior – List of behaviors attached to this component
isActionRequest boolean
isConsoleRequest boolean – The value indicating whether the current request is made via console
isCpRequest boolean
isLivePreview boolean – Whether this is a Live Preview request.
isLoginRequest boolean
isPreview boolean
isSingleActionRequest boolean
isSiteRequest boolean
isWebAliasSetDynamically boolean
isWebrootAliasSetDynamically boolean
params array – The command line arguments.
scriptFile string – Entry script file path (processed w/ realpath())
scriptFilename string
token string, null – The token, or null if there isn’t one.

# isActionRequest

Type
boolean
Access
Read-only

View source

# isCpRequest

Type
boolean
Access
Read-only

View source

# isLivePreview

Type
boolean
Access
Read-only

Whether this is a Live Preview request.

View source

# isLoginRequest

Type
boolean
Access
Read-only
Since
3.2.0

View source

# isPreview

Type
boolean
Access
Read-only
Since
3.2.1

View source

# isSingleActionRequest

Type
boolean
Access
Read-only

View source

# isSiteRequest

Type
boolean
Access
Read-only

View source

# token

Type
string, null
Access
Read-only
Since
3.2.0

The token, or null if there isn’t one.

View source

# Public Methods

Method Description
__call() Calls the named method which is not a class method.
__clone() This method is called after the object is created by cloning an existing one.
__construct() Constructor.
__get() Returns the value of an object property.
__isset() Checks if a property is set, i.e. defined and not null.
__set() Sets value of an object property.
__unset() Sets an object property to null.
attachBehavior() Attaches a behavior to this component.
attachBehaviors() Attaches a list of behaviors to the component.
behaviors() Returns a list of behaviors that this component should behave as.
canGetProperty() Returns a value indicating whether a property can be read.
canSetProperty() Returns a value indicating whether a property can be set.
className() Returns the fully qualified name of this class.
detachBehavior() Detaches a behavior from the component.
detachBehaviors() Detaches all behaviors from the component.
ensureBehaviors() Makes sure that the behaviors declared in behaviors() are attached to this component.
getBehavior() Returns the named behavior object.
getBehaviors() Returns all behaviors attached to this component.
getIsActionRequest() Returns whether a specific controller action was requested. (Narrator: There wasn't.)
getIsConsoleRequest() Returns a value indicating whether the current request is made via command line.
getIsCpRequest() Returns whether the control panel was requested. (Narrator: It wasn't.)
getIsLivePreview() Returns whether this is a Live Preview request. (Narrator: It isn't.)
getIsLoginRequest() Returns whether this was a Login request.
getIsPreview() Returns whether this is an element preview request.
getIsSingleActionRequest() Returns whether the current request is solely an action request. (Narrator: It isn't.)
getIsSiteRequest() Returns whether the front end site was requested. (Narrator: It wasn't.)
getParams() Returns the command line arguments.
getScriptFile() Returns entry script file path.
getScriptFilename() Returns the requested script name being used to access Craft (e.g. “index.php”).
getToken() Returns the token submitted with the request, if there is one.
hasEventHandlers() Returns a value indicating whether there is any handler attached to the named event.
hasMethod() Returns a value indicating whether a method is defined.
hasProperty() Returns a value indicating whether a property is defined.
init() Initializes the object.
off() Detaches an existing event handler from this component.
on() Attaches an event handler to an event.
resolve() Resolves the current request into a route and the associated parameters.
setIsConsoleRequest() Sets the value indicating whether the current request is made via command line.
setParams() Sets the command line arguments.
setScriptFile() Sets the entry script file path.
trigger() Triggers an event.

# getIsActionRequest()

Returns whether a specific controller action was requested. (Narrator: There wasn't.)

View source

Returns

boolean

# getIsCpRequest()

Returns whether the control panel was requested. (Narrator: It wasn't.)

View source

Returns

boolean

# getIsLivePreview()

DEPRECATED

Deprecated in 3.2.0

Returns whether this is a Live Preview request. (Narrator: It isn't.)

View source

Returns

boolean – Whether this is a Live Preview request.

# getIsLoginRequest()

Since
3.2.0

Returns whether this was a Login request.

View source

Returns

boolean

# getIsPreview()

Since
3.2.1

Returns whether this is an element preview request.

View source

Returns

boolean

# getIsSingleActionRequest()

DEPRECATED

Deprecated in 3.2.0

Returns whether the current request is solely an action request. (Narrator: It isn't.)

View source

Returns

boolean

# getIsSiteRequest()

Returns whether the front end site was requested. (Narrator: It wasn't.)

View source

Returns

boolean

# getToken()

Since
3.2.0

Returns the token submitted with the request, if there is one.

View source

Returns

string, null – The token, or null if there isn’t one.

# init()

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

View source