Skip to content

Commit

Permalink
Add documentation and event mapping for beforeMarshal event.
Browse files Browse the repository at this point in the history
Add event hooks and doc blocks for Model.beforeMarshal event.

Refs #5704
  • Loading branch information
markstory committed Jan 21, 2015
1 parent 8b15a08 commit 683a316
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ORM/Behavior.php
Expand Up @@ -249,6 +249,7 @@ public function verifyConfig()
public function implementedEvents()
{
$eventMap = [
'Model.beforeMarshal' => 'beforeMarshal',
'Model.beforeFind' => 'beforeFind',
'Model.beforeSave' => 'beforeSave',
'Model.afterSave' => 'afterSave',
Expand Down
12 changes: 12 additions & 0 deletions src/ORM/Table.php
Expand Up @@ -1813,6 +1813,9 @@ public function marshaller()
* You can also pass the name of the validator to use in the `validate` option.
* If `null` is passed to the first param of this function, no validation will
* be performed.
*
* You can use the `Model.beforeMarshal` event to modify request data
* before it is converted into entities.
*/
public function newEntity($data = null, array $options = [])
{
Expand Down Expand Up @@ -1854,6 +1857,8 @@ public function newEntity($data = null, array $options = [])
* );
* ```
*
* You can use the `Model.beforeMarshal` event to modify request data
* before it is converted into entities.
*/
public function newEntities(array $data, array $options = [])
{
Expand Down Expand Up @@ -1891,6 +1896,9 @@ public function newEntities(array $data, array $options = [])
* 'validate' => false
* ]);
* ```
*
* You can use the `Model.beforeMarshal` event to modify request data
* before it is converted into entities.
*/
public function patchEntity(EntityInterface $entity, array $data, array $options = [])
{
Expand Down Expand Up @@ -1922,6 +1930,9 @@ public function patchEntity(EntityInterface $entity, array $data, array $options
* ]
* );
* ```
*
* You can use the `Model.beforeMarshal` event to modify request data
* before it is converted into entities.
*/
public function patchEntities($entities, array $data, array $options = [])
{
Expand Down Expand Up @@ -2063,6 +2074,7 @@ public function buildRules(RulesChecker $rules)
public function implementedEvents()
{
$eventMap = [
'Model.beforeMarshal' => 'beforeMarshal',
'Model.beforeFind' => 'beforeFind',
'Model.beforeSave' => 'beforeSave',
'Model.afterSave' => 'afterSave',
Expand Down

0 comments on commit 683a316

Please sign in to comment.