@@ -1136,7 +1136,7 @@ protected function parseGetParameterArray($get,$name,$characters) {
1136
1136
1137
1137
protected function applyBeforeHandler (&$ action ,&$ database ,&$ table ,&$ ids ,&$ callback ,&$ inputs ) {
1138
1138
if (is_callable ($ callback ,true )) {
1139
- $ max = ( is_array ($ ids )&& count ($ ids ))? :count ($ inputs );
1139
+ $ max = is_array ($ ids )? count ($ ids ):count ($ inputs );
1140
1140
$ values = array ('action ' =>$ action ,'database ' =>$ database ,'table ' =>$ table );
1141
1141
for ($ i =0 ;$ i <$ max ;$ i ++) {
1142
1142
$ action = $ values ['action ' ];
@@ -1907,9 +1907,9 @@ protected function getParameters($settings) {
1907
1907
1908
1908
// reflection
1909
1909
list ($ tables ,$ collect ,$ select ) = $ this ->findRelations ($ tables ,$ database ,$ auto_include );
1910
- $ fields = $ this ->findFields ($ tables ,$ database );
1911
- if ($ tenancy_function ) $ this ->applyTenancyFunction ($ tenancy_function ,$ action ,$ database ,$ fields ,$ filters );
1912
- $ fields = $ this ->limitFields ($ fields ,$ columns ,$ exclude ,$ select ,$ database );
1910
+ $ allFields = $ this ->findFields ($ tables ,$ database );
1911
+ if ($ tenancy_function ) $ this ->applyTenancyFunction ($ tenancy_function ,$ action ,$ database ,$ allFields ,$ filters );
1912
+ $ fields = $ this ->limitFields ($ allFields ,$ columns ,$ exclude ,$ select ,$ database );
1913
1913
1914
1914
// permissions
1915
1915
if ($ table_authorizer ) $ this ->applyTableAuthorizer ($ table_authorizer ,$ action ,$ database ,$ tables );
@@ -1922,7 +1922,7 @@ protected function getParameters($settings) {
1922
1922
foreach ($ inputs as $ k =>$ context ) {
1923
1923
$ input = $ this ->filterInputByFields ($ context ,$ fields [$ tables [0 ]]);
1924
1924
1925
- if ($ tenancy_function ) $ this ->applyInputTenancy ($ tenancy_function ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]]);
1925
+ if ($ tenancy_function ) $ this ->applyInputTenancy ($ tenancy_function ,$ action ,$ database ,$ tables [0 ],$ input ,$ allFields [$ tables [0 ]]);
1926
1926
if ($ input_sanitizer ) $ this ->applyInputSanitizer ($ input_sanitizer ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]]);
1927
1927
if ($ input_validator ) $ this ->applyInputValidator ($ input_validator ,$ action ,$ database ,$ tables [0 ],$ input ,$ fields [$ tables [0 ]],$ context );
1928
1928
0 commit comments