Свойство | Тип | Описание | |
---|---|---|---|
$components | array | Reference to a Session component | |
$settings | array | validateId ID Argument validation - by default it will inspect your model's primary key and based on it's data type either use integer or uuid validation. Can be disabled by setting it to "false". Supports "integer" and "uuid" configuration By default it's configuration is NULL, which means "auto detect" eventPrefix All emitted events will be prefixed with this property value secureDelete delete() can only be called with the HTTP DELETE verb, not POST when true. If set to false HTTP POST is also acceptable actions contains an array of controller methods this component should offer implementation for. The actions is used for actionMap, viewMap and findMethodMap to change behavior of CrudComponent By default no actions are enabled translations is the settings for the translations Event, responsible for the text used in flash messages see TranslationsEvent::$_defaults the full list of options relatedList is a map of the controller action and the whether it should fetch associations lists to be used in select boxes. An array as value means it is enabled and represent the list of model associations to be fetched saveAllOptions Raw array passed as 2nd argument to saveAll() in add and edit method If you configure a key with your action name, it will override the default settings. This is useful for adding fieldList to enhance security in saveAll. actionMap A map of the controller action and what CRUD action we should call. By default it supports non-prefix and admin_ prefixed routes viewMap A map of the controller action and the view to render By default it supports non-prefix and admin_ prefixed routes findMethodMap The default find method for reading data listenerClassMap List of internal-name => ${plugin}.${class} listeners that will be bound automatically in Crud. By default translations and related model events are bound. Events will always assume to be in the Controller/Event folder |
Свойство | Тип | Описание | |
---|---|---|---|
$_action | string | The current controller action | |
$_controller | Controller | Reference to the current controller | |
$_eventManager | CakeEventManager | Reference to the current event manager | |
$_listeners | array | List of listener objects attached to Crud | |
$_model | Model | Cached property for the current Controller::modelClass instance | |
$_modelName | string | Cached property for Controller::modelClass | |
$_request | CakeRequest | Reference to the current request |
Метод | Описание | |
---|---|---|
__construct ( ComponentCollection $collection, array $settings = [] ) | Constructor | |
config ( mixed $key = null, mixed $value = null ) : TranslationsEvent | Generic config method | |
disableAction ( string $action ) : void | Disable a CRUD action | |
enableAction ( string $action ) : void | Enable a CRUD action | |
executeAction ( string $controllerAction = null, $args = [] ) : mixed | Execute a Crud action | |
getIdFromRequest ( ) : string | Helper method to get the passed ID to an action | |
getListener ( string $name, $create = true ) : CrudBaseEvent | Get a single event class | |
initialize ( Controller $controller ) : void | Make sure to update the list of known controller methods before startup is called | |
isActionMapped ( string | null $action = null ) : boolean | Check if a CRUD action has been mapped (aka should be handled by CRUD component) | |
mapAction ( string $action, string $type, boolean $enable = true ) : void | Map action to a internal request type | |
mapActionView ( string | array $action, string $view = null ) : void | Map the view file to use for a controller action | |
mapFindMethod ( string $action, strign $method ) : void | Map a controller action to a Model::find($method) | |
on ( string | array $events, callback $callback ) : void | Attaches an event listener function to the controller for Crud Events | |
trigger ( string $eventName, array $data = [] ) : CrudSubject | 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. |
Метод | Описание | |
---|---|---|
_addAction ( ) : void | Generic add action | |
_deleteAction ( string $id = null ) : void | Generic delete action | |
_detectPrimaryKeyFieldType ( ) : string | Automatically detect primary key data type for _validateId() | |
_editAction ( string $id = null ) : void | Generic edit action | |
_getFindMethod ( string | null $action = null, string | null $default = null ) : string | Get the model find method for a current controller action | |
_getResourceName ( ) : string | Return the human name of the model | |
_getSaveAllOptions ( string | null $action = null ) : array | Build options for saveAll | |
_getSubject ( array $additional = [] ) : CrudSubject | Create a CakeEvent subject with the required properties | |
_indexAction ( ) : void | Generic index action | |
_loadListener ( string $name ) : void | Load a single event class attached to Crud | |
_loadListeners ( ) : void | Load all event classes attached to Crud | |
_redirect ( CrudSubject $subject, array | null $url = null ) : void | Called for all redirects inside CRUD | |
_setFlash ( string $type ) : void | Wrapper for Session::setFlash | |
_setModelProperties ( ) : void | Set internal model properties from the controller | |
_validateId ( mixed $id ) : boolean | Is the passed ID valid ? | |
_viewAction ( string $id = null ) : void | Generic view action |
public __construct ( ComponentCollection $collection, array $settings = [] ) | ||
$collection | ComponentCollection | A ComponentCollection this component can use to lazy load its components |
$settings | array | Array of configuration settings. |
protected _addAction ( ) : void | ||
Результат | void |
protected _deleteAction ( string $id = null ) : void | ||
$id | string | |
Результат | void |
protected _detectPrimaryKeyFieldType ( ) : string | ||
Результат | string |
protected _editAction ( string $id = null ) : void | ||
$id | string | |
Результат | void |
protected _getResourceName ( ) : string | ||
Результат | string |
protected _getSubject ( array $additional = [] ) : CrudSubject | ||
$additional | array | Additional properties for the subject |
Результат | CrudSubject |
protected _indexAction ( ) : void | ||
Результат | void |
protected _loadListener ( string $name ) : void | ||
$name | string | |
Результат | void |
protected _loadListeners ( ) : void | ||
Результат | void |
protected _setModelProperties ( ) : void | ||
Результат | void |
protected _validateId ( mixed $id ) : boolean | ||
$id | mixed | |
Результат | boolean |
protected _viewAction ( string $id = null ) : void | ||
$id | string | |
Результат | void |
public disableAction ( string $action ) : void | ||
$action | string | The action to disable |
Результат | void |
public enableAction ( string $action ) : void | ||
$action | string | The action to enable |
Результат | void |
public executeAction ( string $controllerAction = null, $args = [] ) : mixed | ||
$controllerAction | string | Override the controller action to execute as |
Результат | mixed | void, or a CakeResponse object |
public getIdFromRequest ( ) : string | ||
Результат | string |
public getListener ( string $name, $create = true ) : CrudBaseEvent | ||
$name | string | |
Результат | CrudBaseEvent |
public initialize ( Controller $controller ) : void | ||
$controller | Controller | |
Результат | void |
public mapFindMethod ( string $action, strign $method ) : void | ||
$action | string | |
$method | strign | |
Результат | void |
protected string $_action | ||
Результат | string |
protected Controller $_controller | ||
Результат | Controller |
protected CakeEventManager $_eventManager | ||
Результат | CakeEventManager |
protected array $_listeners | ||
Результат | array |
protected Model $_model | ||
Результат | Model |
protected string $_modelName | ||
Результат | string |
protected CakeRequest $_request | ||
Результат | CakeRequest |
public array $components | ||
Результат | array |
public array $settings | ||
Результат | array |