PHP 클래스 yii\rest\Action

For more details and usage information on Action, see the guide article on rest controllers.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends yii\base\Action
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$checkAccess a PHP callable that will be called when running an action to determine if the current user has the permission to execute the action. If not set, the access check will not be performed. The signature of the callable should be as follows, php function ($action, $model = null) { $model is the requested model instance. If null, it means no specific model (e.g. IndexAction) }
$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.
$modelClass class name of the model which will be handled by this action. The model class must implement [[ActiveRecordInterface]]. This property must be set.

공개 메소드들

메소드 설명
findModel ( string $id ) : yii\db\ActiveRecordInterface Returns the data model based on the primary key given.
init ( )

메소드 상세

findModel() 공개 메소드

If the data model is not found, a 404 HTTP exception will be raised.
public findModel ( string $id ) : yii\db\ActiveRecordInterface
$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 the model found

init() 공개 메소드

public init ( )

프로퍼티 상세

$checkAccess 공개적으로 프로퍼티

a PHP callable that will be called when running an action to determine if the current user has the permission to execute the action. If not set, the access check will not be performed. The signature of the callable should be as follows, php function ($action, $model = null) { $model is the requested model instance. If null, it means no specific model (e.g. IndexAction) }
public $checkAccess

$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

$modelClass 공개적으로 프로퍼티

class name of the model which will be handled by this action. The model class must implement [[ActiveRecordInterface]]. This property must be set.
public $modelClass