PHP Class Tools\Model\Behavior\StringBehavior
Note that most string modification should be done once, on save.
Prevent using output modification if possible as it is done on every fetch.
Tip: If you have other behaviors that might modify the array data prior to saving, better use a higher priority:
$this->addBehavior('Tools.String', array('priority' => 11, ...));
So that it is run last.
Usage: See docs
Show file
Open project: dereuromark/cakephp-tools
Protected Properties
Public Methods
Method |
Description |
|
_process ( string $val, array $map ) : string |
Process val via map |
|
beforeFind ( Cake\Event\Event $event, Query $query ) : void |
Decode the fields on after find |
|
beforeSave ( Cake\Event\Event $event, Cake\ORM\Entity $entity, ArrayObject $options ) : void |
Saves all fields that do not belong to the current Model into 'with' helper model. |
|
initialize ( array $config = [] ) : void |
|
|
processItems ( Cake\ORM\Entity $entity, string $type = 'input' ) : void |
Decodes the fields of an array/entity (if the value itself was encoded) |
|
Method Details
beforeFind()
public method
Decode the fields on after find
public beforeFind ( Cake\Event\Event $event, Query $query ) : void |
$event |
Cake\Event\Event |
|
$query |
Cake\ORM\Query |
|
return |
void |
|
beforeSave()
public method
Saves all fields that do not belong to the current Model into 'with' helper model.
public beforeSave ( Cake\Event\Event $event, Cake\ORM\Entity $entity, ArrayObject $options ) : void |
$event |
Cake\Event\Event |
|
$entity |
Cake\ORM\Entity |
|
$options |
ArrayObject |
|
return |
void |
|
initialize()
public method
processItems()
public method
Decodes the fields of an array/entity (if the value itself was encoded)
Property Details
$_defaultConfig protected property
TODO: json input/ouput directly, clean
protected array $_defaultConfig |
return |
array |
|