@@ -1137,7 +1137,9 @@ protected function parseGetParameterArray($get,$name,$characters) {
11371137 protected function applyBeforeHandler (&$ action ,&$ database ,&$ table ,&$ ids ,&$ callback ,&$ inputs ) {
11381138 if (is_callable ($ callback ,true )) {
11391139 $ max = count ($ ids )?:count ($ inputs );
1140+ $ origaction = $ action ;
11401141 for ($ i =0 ;$ i <$ max ;$ i ++) {
1142+ $ action = $ origaction ;
11411143 if (!isset ($ ids [$ i ])) $ ids [$ i ] = false ;
11421144 if (!isset ($ inputs [$ i ])) $ inputs [$ i ] = false ;
11431145 $ callback ($ action ,$ database ,$ table ,$ ids [$ i ],$ inputs [$ i ]);
@@ -1885,10 +1887,6 @@ protected function getParameters($settings) {
18851887
18861888 // input
18871889 $ inputs = $ this ->retrieveInputs ($ post );
1888- if ($ before ) {
1889- $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ inputs );
1890- }
1891-
18921890 foreach ($ inputs as $ k =>$ context ) {
18931891 $ input = $ this ->filterInputByFields ($ context ,$ fields [$ tables [0 ]]);
18941892
@@ -1900,6 +1898,10 @@ protected function getParameters($settings) {
19001898 $ inputs [$ k ] = $ input ;
19011899 }
19021900
1901+ if ($ before ) {
1902+ $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ inputs );
1903+ }
1904+
19031905 return compact ('action ' ,'database ' ,'tables ' ,'key ' ,'page ' ,'filters ' ,'fields ' ,'orderings ' ,'transform ' ,'inputs ' ,'collect ' ,'select ' ,'before ' ,'after ' );
19041906 }
19051907
0 commit comments