PHP 클래스 yii2tech\admin\actions\Action

부터: 1.0
저자: Paul Klimov ([email protected])
상속: extends yii\base\Action
파일 보기 프로젝트 열기: yii2tech/admin 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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