PHP Class RelatedModelsListener, Platform-Crud-Plugin

Inheritance: implements CakeEventListener
Datei anzeigen Open project: nodesagency/Platform-Crud-Plugin

Protected Properties

Property Type Description
$_crud CrudComponent Crud Component reference
$_subject CrudSubject Crud Event subject

Public Methods

Method Description
__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

Protected Methods

Method Description
_getModelInstance ( string $model, Model $controllerModel, Controller $controller ) : Model Returns model instance based on its name

Method Details

__construct() public method

Class constructor
public __construct ( CrudSubject $subject ) : void
$subject CrudSubject
return void

_getModelInstance() protected method

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
return Model

beforeRender() public method

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
return void

enable() public method

Enables association list fetching for specified actions.
public enable ( string | array $actions ) : void
$actions string | array list of action names to enable
return void

implementedEvents() public method

List of events implemented by this class
public implementedEvents ( ) : array
return array

map() public method

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
return void

models() public method

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
return array

Property Details

$_crud protected_oe property

Crud Component reference
protected CrudComponent $_crud
return CrudComponent

$_subject protected_oe property

Crud Event subject
protected CrudSubject $_subject
return CrudSubject