File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 2323use Cake \Utility \Hash ;
2424use Cake \Validation \ValidatorAwareInterface ;
2525use Cake \Validation \ValidatorAwareTrait ;
26+ use function Cake \Core \deprecationWarning ;
2627
2728/**
2829 * Form abstraction used to create forms not tied to ORM backed models,
@@ -282,6 +283,21 @@ public function execute(array $data, array $options = []): bool
282283 * @return bool
283284 */
284285 protected function _execute (array $ data ): bool
286+ {
287+ deprecationWarning ('5.3.0 ' , 'The _execute() method is deprecated. Override the process() method instead. ' );
288+
289+ return $ this ->process ($ data );
290+ }
291+
292+ /**
293+ * Hook method to be implemented in subclasses.
294+ *
295+ * Used by `execute()` to execute the form's action.
296+ *
297+ * @param array $data Form data.
298+ * @return bool
299+ */
300+ protected function process (array $ data ): bool
285301 {
286302 return true ;
287303 }
Original file line number Diff line number Diff line change @@ -193,7 +193,9 @@ public function testExecuteValid(): void
193193 'email ' => 'test@example.com ' ,
194194 ];
195195
196- $ this ->assertTrue ($ form ->execute ($ data ));
196+ $ this ->deprecated (function () use ($ form , $ data ): void {
197+ $ this ->assertTrue ($ form ->execute ($ data ));
198+ });
197199 }
198200
199201 /**
@@ -208,7 +210,9 @@ public function testExecuteSkipValidation(): void
208210 'email ' => 'wrong ' ,
209211 ];
210212
211- $ this ->assertTrue ($ form ->execute ($ data , ['validate ' => false ]));
213+ $ this ->deprecated (function () use ($ form , $ data ): void {
214+ $ this ->assertTrue ($ form ->execute ($ data , ['validate ' => false ]));
215+ });
212216 }
213217
214218 /**
You can’t perform that action at this time.
0 commit comments