PHP Класс yii2tech\admin\behaviors\ModelControlBehavior

This behavior should be attached to Controller instance.
С версии: 1.0
Автор: Paul Klimov ([email protected])
Наследование: extends yii\base\Behavior
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$modelClass the model class name. This property must be set. The model class must implement [[ActiveRecordInterface]].
$searchModelClass class name of the model which should be used as search model. This can be a PHP callback of following signature: php function (\yii\web\Controller $controller) { return new \yii\base\Model; } If not set it will be composed using [[modelClass]]. If yii2tech/ar-search extension is installed - [[\yii2tech\ar\search\ActiveSearchModel]] instance will be used as a search model.

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

Метод Описание
findModel ( string $id ) : yii\db\ActiveRecordInterface | Model Returns the data model based on the primary key given.
newModel ( ) : yii\db\ActiveRecordInterface | Model Creates new model instance.
newSearchModel ( ) : Model Creates new search model instance.

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

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

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

Creates new model instance.
public newModel ( ) : yii\db\ActiveRecordInterface | Model
Результат yii\db\ActiveRecordInterface | yii\base\Model new model instance.

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

Creates new search model instance.
public newSearchModel ( ) : Model
Результат yii\base\Model new search model instance.

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

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

the model class name. This property must be set. The model class must implement [[ActiveRecordInterface]].
См. также: newModel()
См. также: findModel()
public $modelClass

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

class name of the model which should be used as search model. This can be a PHP callback of following signature: php function (\yii\web\Controller $controller) { return new \yii\base\Model; } If not set it will be composed using [[modelClass]]. If yii2tech/ar-search extension is installed - [[\yii2tech\ar\search\ActiveSearchModel]] instance will be used as a search model.
См. также: newSearchModel()
public $searchModelClass