프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_action | string | The current controller action. | |
$_actionInstances | array | List of crud actions. | |
$_controller | Reference to the current controller. | ||
$_defaultConfig | array | eventPrefix All emitted events will be prefixed with this property value. actions contains an array of controller methods this component should offer implementation for. Each action maps to a CrudAction class. $controllerAction => $crudActionClass. Example: array('admin_index' => 'Crud.Index') By default no actions are enabled. listeners List of internal-name => ${plugin}.${class} listeners that will be bound automatically in Crud. By default the related model event are bound. Events will always assume to be in the Controller/Event folder. eventLogging boolean to determine whether the class should log triggered events. | |
$_eventLog | array | A flat array of the events triggered. | |
$_eventManager | Cake\Event\EventManager | Reference to the current event manager. | |
$_listenerInstances | array | List of listener objects attached to Crud. | |
$_modelName | string | Cached property for Controller::$modelClass. This is the model name of the current model. | |
$_request | Cake\Network\Request | Reference to the current request. |
메소드 | 설명 | |
---|---|---|
__construct ( Cake\Controller\ComponentRegistry $collection, array $config = [] ) | Constructor | |
action ( string | null $name = null ) : |
Get a CrudAction object by action name. | |
addListener ( string $name, string $className = null, array $config = [] ) : void | Add a new listener to Crud | |
beforeFilter ( Cake\Event\Event $event ) : void | Add self to list of components capable of dispatching an action. | |
controller ( ) : |
Returns controller instance | |
defaults ( string $type, string | array $name, mixed $config = null ) : mixed | Set or get defaults for listeners and actions. | |
disable ( string | array $actions ) : void | Disable one or multiple CRUD actions. | |
enable ( string | array $actions ) : void | Enable one or multiple CRUD actions. | |
entity ( array $data = [] ) : Cake\ORM\Entity | Returns new entity | |
eventLog ( ) : array | Returns an array of triggered events. | |
execute ( string $controllerAction = null, array $args = [] ) : |
Execute a Crud action | |
findMethod ( string | array $action, string | null $method = null ) : void | Map a controller action to a Model::find($method). | |
getSubject ( array $additional = [] ) : Crud\Event\Subject | Create a CakeEvent subject with the required properties. | |
isActionMapped ( string | null $action = null ) : boolean | Check if a CRUD action has been mapped (whether it will be handled by CRUD component) | |
listener ( string $name ) : |
Get a single event class. | |
logEvent ( string $eventName, array $data = [] ) : void | Add a log entry for the event. | |
mapAction ( string $action, string | array $config = [], boolean $enable = true ) : void | Map action to an internal request type. | |
normalizeArray ( array $array ) : array | Normalize config array | |
on ( string | array $events, callback $callback, array $options = [] ) : void | Attaches an event listener function to the controller for Crud Events. | |
removeListener ( string $name ) : boolean | Remove a listener from Crud. | |
startup ( Cake\Event\Event $event ) : void | Called after the Controller::beforeFilter() and before the controller action. | |
table ( ) : |
Returns controller's table instance. | |
trigger ( string $eventName, Crud\Event\Subject $data = null ) : Cake\Event\Event | Triggers a Crud event by creating a new subject and filling it with $data if $data is an instance of CrudSubject it will be reused as the subject object for this event. | |
useModel ( string $modelName ) : void | Sets the model class to be used during the action execution. | |
view ( string | array $action, string | null $view = null ) : void | Map the view file to use for a controller action. | |
viewVar ( string | array $action, string | null $viewVar = null ) : void | Change the viewVar name for one or multiple actions. |
메소드 | 설명 | |
---|---|---|
_loadAction ( string $name ) : |
Load a CrudAction instance. | |
_loadListener ( string $name ) : |
Load a single event class attached to Crud. | |
_loadListeners ( ) : void | Load all event classes attached to Crud. |
public __construct ( Cake\Controller\ComponentRegistry $collection, array $config = [] ) | ||
$collection | Cake\Controller\ComponentRegistry | A ComponentCollection this component can use to lazy load its components. |
$config | array | Array of configuration settings. |
protected _loadAction ( string $name ) : |
||
$name | string | The controller action name. |
리턴 |
protected _loadListener ( string $name ) : |
||
$name | string | Name |
리턴 |
protected _loadListeners ( ) : void | ||
리턴 | void |
public beforeFilter ( Cake\Event\Event $event ) : void | ||
$event | Cake\Event\Event | Event instance |
리턴 | void |
public controller ( ) : |
||
리턴 |
public defaults ( string $type, string | array $name, mixed $config = null ) : mixed | ||
$type | string | Can be anything, but 'listeners' or 'actions' is currently only used. |
$name | string | array | The name of the $type - e.g. 'api', 'relatedModels' or an array ('api', 'relatedModels'). If $name is an array, the $config will be applied to each entry in the $name array. |
$config | mixed | If NULL, the defaults is returned, else the defaults are changed. |
리턴 | mixed |
public getSubject ( array $additional = [] ) : Crud\Event\Subject | ||
$additional | array | Additional properties for the subject. |
리턴 | Crud\Event\Subject |
public normalizeArray ( array $array ) : array | ||
$array | array | List to normalize |
리턴 | array |
public on ( string | array $events, callback $callback, array $options = [] ) : void | ||
$events | string | array | Name of the Crud Event you want to attach to controller. |
$callback | callback | Callable method or closure to be executed on event. |
$options | array | Used to set the `priority` and `passParams` flags to the listener. |
리턴 | void |
public removeListener ( string $name ) : boolean | ||
$name | string | Name |
리턴 | boolean |
protected Controller,Cake\Controller $_controller | ||
리턴 |
protected array $_defaultConfig | ||
리턴 | array |
protected EventManager,Cake\Event $_eventManager | ||
리턴 | Cake\Event\EventManager |
protected array $_listenerInstances | ||
리턴 | array |
protected string $_modelName | ||
리턴 | string |