PHP Класс RelatedModelsListener, Platform-Crud-Plugin

Наследование: implements CakeEventListener
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_crud CrudComponent Crud Component reference
$_subject CrudSubject Crud Event subject

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

Метод Описание
__construct ( CrudSubject $subject ) : void Class constructor
beforeRender ( $event ) : void Fetches related models' list and sets them to a variable for the view Lists are limited buy default to 200 items. Should you need more, attach an event listener for beforeListRelated event to modify the query
enable ( string | array $actions ) : void Enables association list fetching for specified actions.
implementedEvents ( ) : array List of events implemented by this class
map ( array | boolean $models, string $action = null ) : void Sets the list of model relationships to be fetched as lists for an action
models ( string $action = null ) : array Gets the list of associated model lists to be fetched for an action

Защищенные методы

Метод Описание
_getModelInstance ( string $model, Model $controllerModel, Controller $controller ) : Model Returns model instance based on its name

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

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

Class constructor
public __construct ( CrudSubject $subject ) : void
$subject CrudSubject
Результат void

_getModelInstance() защищенный Метод

Returns model instance based on its name
protected _getModelInstance ( string $model, Model $controllerModel, Controller $controller ) : Model
$model string name of the model
$controllerModel Model default model instance for controller
$controller Controller instance to do a first look on it
Результат Model

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

Fetches related models' list and sets them to a variable for the view Lists are limited buy default to 200 items. Should you need more, attach an event listener for beforeListRelated event to modify the query
public beforeRender ( $event ) : void
Результат void

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

Enables association list fetching for specified actions.
public enable ( string | array $actions ) : void
$actions string | array list of action names to enable
Результат void

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

List of events implemented by this class
public implementedEvents ( ) : array
Результат array

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

Sets the list of model relationships to be fetched as lists for an action
public map ( array | boolean $models, string $action = null ) : void
$models array | boolean list of model association names to be fetch on $action if `true`, list of models will be constructed out of associated models of main controller's model
$action string name of the action to apply this rule to. If left null then it will use the current controller action
Результат void

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

Gets the list of associated model lists to be fetched for an action
public models ( string $action = null ) : array
$action string name of the action
Результат array

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

$_crud защищенное свойство

Crud Component reference
protected CrudComponent $_crud
Результат CrudComponent

$_subject защищенное свойство

Crud Event subject
protected CrudSubject $_subject
Результат CrudSubject