@@ -1137,7 +1137,9 @@ protected function parseGetParameterArray($get,$name,$characters) {
1137
1137
protected function applyBeforeHandler (&$ action ,&$ database ,&$ table ,&$ ids ,&$ callback ,&$ inputs ) {
1138
1138
if (is_callable ($ callback ,true )) {
1139
1139
$ max = count ($ ids )?:count ($ inputs );
1140
+ $ origaction = $ action ;
1140
1141
for ($ i =0 ;$ i <$ max ;$ i ++) {
1142
+ $ action = $ origaction ;
1141
1143
if (!isset ($ ids [$ i ])) $ ids [$ i ] = false ;
1142
1144
if (!isset ($ inputs [$ i ])) $ inputs [$ i ] = false ;
1143
1145
$ callback ($ action ,$ database ,$ table ,$ ids [$ i ],$ inputs [$ i ]);
@@ -1885,10 +1887,6 @@ protected function getParameters($settings) {
1885
1887
1886
1888
// input
1887
1889
$ inputs = $ this ->retrieveInputs ($ post );
1888
- if ($ before ) {
1889
- $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ inputs );
1890
- }
1891
-
1892
1890
foreach ($ inputs as $ k =>$ context ) {
1893
1891
$ input = $ this ->filterInputByFields ($ context ,$ fields [$ tables [0 ]]);
1894
1892
@@ -1900,6 +1898,10 @@ protected function getParameters($settings) {
1900
1898
$ inputs [$ k ] = $ input ;
1901
1899
}
1902
1900
1901
+ if ($ before ) {
1902
+ $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ inputs );
1903
+ }
1904
+
1903
1905
return compact ('action ' ,'database ' ,'tables ' ,'key ' ,'page ' ,'filters ' ,'fields ' ,'orderings ' ,'transform ' ,'inputs ' ,'collect ' ,'select ' ,'before ' ,'after ' );
1904
1906
}
1905
1907
0 commit comments