PHP Class Search\Controller\Component\PrgComponent

Inheritance: extends Cake\Controller\Component
Show file Open project: friendsofcake/search Class Usage Examples

Protected Properties

Property Type Description
$_defaultConfig array ### Options - actions : Action name(s) to use PRG for. You can pass a single action as string or multiple as array. If boolean true all actions will be processed if false none. Default is ['index', 'lookup']. - queryStringToData : Set query string as request data. Default true. - queryStringWhitelist : An array of whitelisted query strings to be kept. Defaults to the Paginator 'sort', 'direction' and 'limit' ones.

Public Methods

Method Description
conversion ( boolean $redirect = true ) : Response | null POST to GET / GET to POST conversion
startup ( ) : Response | null Checks if the current request has posted data and redirects the users to the same action after converting the post data into GET params

Protected Methods

Method Description
_actionCheck ( ) : boolean Checks if the action should be processed by the component.
_filterParams ( ) : array Filters the params from POST data and merges in the whitelisted query string ones.

Method Details

_actionCheck() protected method

Checks if the action should be processed by the component.
protected _actionCheck ( ) : boolean
return boolean

_filterParams() protected method

Filters the params from POST data and merges in the whitelisted query string ones.
protected _filterParams ( ) : array
return array

conversion() public method

POST to GET / GET to POST conversion
public conversion ( boolean $redirect = true ) : Response | null
$redirect boolean Redirect on post, default true.
return Cake\Network\Response | null

startup() public method

Checks if the current request has posted data and redirects the users to the same action after converting the post data into GET params
public startup ( ) : Response | null
return Cake\Network\Response | null

Property Details

$_defaultConfig protected property

### Options - actions : Action name(s) to use PRG for. You can pass a single action as string or multiple as array. If boolean true all actions will be processed if false none. Default is ['index', 'lookup']. - queryStringToData : Set query string as request data. Default true. - queryStringWhitelist : An array of whitelisted query strings to be kept. Defaults to the Paginator 'sort', 'direction' and 'limit' ones.
protected array $_defaultConfig
return array