PHP Класс yii2tech\admin\actions\Action

С версии: 1.0
Автор: Paul Klimov ([email protected])
Наследование: extends yii\base\Action
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$findModel a PHP callable that will be called to return the model corresponding to the specified primary key value. If not set, Action::findModel will be used instead. The signature of the callable should be: php function ($id, $action) { $id is the primary key value. If composite primary key, the key values will be separated by comma. $action is the action object currently running } The callable should return the model found, or throw an exception if not found.
$returnAction ID of the controller action, which user should be redirected to on success. This property overrides the value set by Action::setReturnAction method.
$returnUrl URL, which user should be redirected to on success. This could be a plain string URL, URL array configuration or callable, which returns actual URL. The signature for the callable is following: string|array function (Model $model) } Note: actual list of the callable arguments may vary depending on particular action class. Note: this option takes precedence over [[returnAction]] related logic.

Открытые методы

Метод Описание
actionExists ( string $id ) : boolean Checks whether action with specified ID exists in owner controller.
createReturnUrl ( string $defaultActionId = 'index', yii\db\ActiveRecordInterface | Model | null $model = null ) : array | string
findModel ( string $id ) : yii\db\ActiveRecordInterface | Model Returns the data model based on the primary key given.
getReturnAction ( string $defaultActionId = 'index' ) : string Returns the ID of action, which should be used for return redirect.
setFlash ( string | array | null $message, array $params = [] ) Sets a flash message.
setReturnAction ( string | null $actionId = null ) Sets the return action ID.

Описание методов

actionExists() публичный Метод

Checks whether action with specified ID exists in owner controller.
public actionExists ( string $id ) : boolean
$id string action ID.
Результат boolean whether action exists or not.

createReturnUrl() публичный Метод

public createReturnUrl ( string $defaultActionId = 'index', yii\db\ActiveRecordInterface | Model | null $model = null ) : array | string
$defaultActionId string default action ID.
$model yii\db\ActiveRecordInterface | yii\base\Model | null model being processed by action.
Результат array | string URL

findModel() публичный Метод

If the data model is not found, a 404 HTTP exception will be raised.
public findModel ( string $id ) : yii\db\ActiveRecordInterface | Model
$id string the ID of the model to be loaded. If the model has a composite primary key, the ID must be a string of the primary key values separated by commas. The order of the primary key values should follow that returned by the `primaryKey()` method of the model.
Результат yii\db\ActiveRecordInterface | yii\base\Model the model found

getReturnAction() публичный Метод

If action belongs to another controller or does not exist in current controller - 'index' is returned.
public getReturnAction ( string $defaultActionId = 'index' ) : string
$defaultActionId string default action ID.
Результат string action ID.

setFlash() публичный Метод

Sets a flash message.
public setFlash ( string | array | null $message, array $params = [] )
$message string | array | null flash message(s) to be set. If plain string is passed, it will be used as a message with the key 'success'. You may specify multiple messages as an array, if element name is not integer, it will be used as a key, otherwise 'success' will be used as key. If empty value passed, no flash will be set. Particular message value can be a PHP callback, which should return actual message. Such callback, should have following signature: ```php function (array $params) { // return string } ```
$params array extra params for the message parsing in format: key => value.

setReturnAction() публичный Метод

Sets the return action ID.
public setReturnAction ( string | null $actionId = null )
$actionId string | null action ID, if not set current action will be used.

Описание свойств

$findModel публичное свойство

a PHP callable that will be called to return the model corresponding to the specified primary key value. If not set, Action::findModel will be used instead. The signature of the callable should be: php function ($id, $action) { $id is the primary key value. If composite primary key, the key values will be separated by comma. $action is the action object currently running } The callable should return the model found, or throw an exception if not found.
public $findModel

$returnAction публичное свойство

ID of the controller action, which user should be redirected to on success. This property overrides the value set by Action::setReturnAction method.
См. также: getReturnAction()
См. также: returnUrl
public $returnAction

$returnUrl публичное свойство

URL, which user should be redirected to on success. This could be a plain string URL, URL array configuration or callable, which returns actual URL. The signature for the callable is following: string|array function (Model $model) } Note: actual list of the callable arguments may vary depending on particular action class. Note: this option takes precedence over [[returnAction]] related logic.
См. также: returnAction
public $returnUrl