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
Public Properties
Property | Description |
---|---|
behaviors | yii\base\Behavior – List of behaviors attached to this component. |
hadToken | boolean |
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 |
isSiteRequest | boolean |
isWebAliasSetDynamically | boolean |
isWebrootAliasSetDynamically | boolean |
params | array – The command line arguments. |
scriptFile | string – Entry script file path (processed w/ realpath()). |
scriptFilename | string – The requested script name being used to access Craft (e.g. “index.php”). |
siteToken | string, null – The token, or null if there isn’t one. |
token | string, null – The token, or null if there isn’t one. |
hadToken
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 3.6.0
isActionRequest
- Type
- boolean
- Default value
null
- Access
- Read-only
isCpRequest
- Type
- boolean
- Default value
null
- Access
- Read-only
isLivePreview
- Type
- boolean
- Default value
null
- Access
- Read-only
Whether this is a Live Preview request.
isLoginRequest
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 3.2.0
isPreview
- Type
- boolean
- Default value
null
- Access
- Read-only
- Since
- 3.2.1
isSiteRequest
- Type
- boolean
- Default value
null
- Access
- Read-only
siteToken
The token, or null
if there isn’t one.
token
The token, or null
if there isn’t one.
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 a component property. |
__isset() | Checks if a property is set, i.e. defined and not null. |
__set() | Sets the value of a component property. |
__unset() | Sets a component property to be 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. |
getHadToken() | Returns whether the request initially had a token. |
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 classic Live Preview request. |
getIsLoginRequest() | Returns whether this was a Login request. |
getIsPreview() | Returns whether this is an element preview request. |
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”). |
getSiteToken() | Returns the site token submitted with the request, if there is one. |
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 for this component. |
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. |
setToken() | Sets the token value. |
trigger() | Triggers an event. |
getHadToken()
- Since
- 3.6.0
Returns whether the request initially had a token.
Returns
getIsActionRequest()
Returns whether a specific controller action was requested. (Narrator: There wasn't.)
Returns
getIsCpRequest()
Returns whether the control panel was requested. (Narrator: It wasn't.)
Returns
getIsLivePreview()
DEPRECATED
Deprecated in 3.2.0
Returns whether this is a classic Live Preview request.
Returns
boolean – Whether this is a Live Preview request.
getIsLoginRequest()
- Since
- 3.2.0
Returns whether this was a Login request.
Returns
getIsPreview()
- Since
- 3.2.1
Returns whether this is an element preview request.
Returns
getIsSiteRequest()
Returns whether the front end site was requested. (Narrator: It wasn't.)
Returns
getSiteToken()
- Since
- 3.6.0
Returns the site token submitted with the request, if there is one.
Returns
string, null – The token, or null
if there isn’t one.
getToken()
- Since
- 3.2.0
Returns the token submitted with the request, if there is one.
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.
setToken()
- Since
- 3.6.0
Sets the token value.