@@ -1862,6 +1862,13 @@ protected function getParameters($settings) {
1862
1862
$ page = $ this ->processPageParameter ($ page );
1863
1863
$ orderings = $ this ->processOrderingsParameter ($ orderings );
1864
1864
1865
+ // input
1866
+ $ multi = (strpos ($ key [0 ],', ' )!==false ) || (strlen ($ post )?($ post [0 ]=='[ ' ):false );
1867
+ $ inputs = $ this ->retrieveInputs ($ post );
1868
+ if ($ before ) {
1869
+ $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ inputs );
1870
+ }
1871
+
1865
1872
// reflection
1866
1873
list ($ tables ,$ collect ,$ select ) = $ this ->findRelations ($ tables ,$ database ,$ auto_include );
1867
1874
$ fields = $ this ->findFields ($ tables ,$ columns ,$ exclude ,$ select ,$ database );
@@ -1873,22 +1880,15 @@ protected function getParameters($settings) {
1873
1880
if ($ tenancy_function ) $ this ->applyTenancyFunction ($ tenancy_function ,$ action ,$ database ,$ fields ,$ filters );
1874
1881
if ($ column_authorizer ) $ this ->applyColumnAuthorizer ($ column_authorizer ,$ action ,$ database ,$ fields );
1875
1882
1876
- // input
1877
- $ multi = (strpos ($ key [0 ],', ' )!==false ) || (strlen ($ post )?($ post [0 ]=='[ ' ):false );
1878
- $ contexts = $ this ->retrieveInputs ($ post );
1879
- if ($ before ) {
1880
- $ this ->applyBeforeHandler ($ action ,$ database ,$ tables [0 ],$ key [0 ],$ before ,$ contexts );
1881
- }
1882
- $ inputs = array ();
1883
- foreach ($ contexts as $ context ) {
1883
+ foreach ($ inputs as $ k =>$ context ) {
1884
1884
$ input = $ this ->filterInputByFields ($ context ,$ fields [$ tables [0 ]]);
1885
1885
1886
1886
if ($ tenancy_function ) $ this ->applyInputTenancy ($ tenancy_function ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]]);
1887
1887
if ($ input_sanitizer ) $ this ->applyInputSanitizer ($ input_sanitizer ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]]);
1888
1888
if ($ input_validator ) $ this ->applyInputValidator ($ input_validator ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]],$ context );
1889
1889
1890
1890
$ this ->convertInputs ($ input ,$ fields [$ tables [0 ]]);
1891
- $ inputs [] = $ input ;
1891
+ $ inputs [$ k ] = $ input ;
1892
1892
}
1893
1893
1894
1894
return compact ('action ' ,'database ' ,'tables ' ,'key ' ,'page ' ,'filters ' ,'fields ' ,'orderings ' ,'transform ' ,'multi ' ,'inputs ' ,'collect ' ,'select ' ,'before ' ,'after ' );
0 commit comments