From 683a31628ee6d4c1b8238ffd4035ad7bcb674816 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Tue, 20 Jan 2015 21:42:28 -0500 Subject: [PATCH] Add documentation and event mapping for beforeMarshal event. Add event hooks and doc blocks for Model.beforeMarshal event. Refs #5704 --- src/ORM/Behavior.php | 1 + src/ORM/Table.php | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/ORM/Behavior.php b/src/ORM/Behavior.php index 224aeccaaad..ac47e2777f5 100644 --- a/src/ORM/Behavior.php +++ b/src/ORM/Behavior.php @@ -249,6 +249,7 @@ public function verifyConfig() public function implementedEvents() { $eventMap = [ + 'Model.beforeMarshal' => 'beforeMarshal', 'Model.beforeFind' => 'beforeFind', 'Model.beforeSave' => 'beforeSave', 'Model.afterSave' => 'afterSave', diff --git a/src/ORM/Table.php b/src/ORM/Table.php index 9e92302c81c..40fb9f65321 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -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 = []) { @@ -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 = []) { @@ -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 = []) { @@ -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 = []) { @@ -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',