File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -229,8 +229,6 @@ protected function mergeData()
229229 $ requestData = $ this ->request ->data ;
230230 $ sessionKey = $ requestData [$ this ->hiddenKey ];
231231 $ sessionData = $ this ->readData ($ sessionKey );
232-
233- $ entity = $ this ->handleNewEntity ($ requestData );
234232 if (!$ this ->isMultiple ()) {
235233 $ requestData = $ this ->fieldAdjustment ($ requestData );
236234 } else {
@@ -285,6 +283,15 @@ private function fieldAdjustment($data)
285283 }
286284 }
287285
286+ $ data = new \ArrayObject ($ data );
287+ if (method_exists ($ this ->Table , 'beforeMarshal ' )) {
288+ // バリデーションにかける beforeMarshal を実行
289+ $ options = new \ArrayObject ([]);
290+ $ this ->Table ->dispatchEvent ('Model.beforeMarshal ' , compact ('data ' , 'options ' ));
291+ }
292+ // ArrayObjectから配列に戻す
293+ $ data = $ data ->getArrayCopy ();
294+
288295 $ sampleEntity = $ this ->handleNewEntity ($ data );
289296 $ sampleArray = $ sampleEntity ->toArray ();
290297 $ setFields = array_diff_key ($ sampleArray , $ data );
You can’t perform that action at this time.
0 commit comments