Browse Source

Adjust before handler to facilitate #130

Maurits van der Schee 8 years ago
parent
commit
272f5759f4
2 changed files with 2 additions and 7 deletions
  1. 2
    7
      api.php
  2. BIN
      data/blog.db

+ 2
- 7
api.php View File

@@ -1134,13 +1134,8 @@ class PHP_CRUD_API {
1134 1134
 		return $values;
1135 1135
 	}
1136 1136
 
1137
-	protected function applyBeforeHandler($parameters,&$inputs) {
1138
-		$callback = $parameters['before'];
1137
+	protected function applyBeforeHandler(&$action,&$database,&$table,&$id,&$callback,&$inputs) {
1139 1138
 		if (is_callable($callback,true)) {
1140
-			$action = $parameters['action'];
1141
-			$database = $parameters['database'];
1142
-			$table = $parameters['tables'][0];
1143
-			$id = $parameters['key'][0];
1144 1139
 			$callback($action,$database,$table,$id,$inputs);
1145 1140
 		}
1146 1141
 	}
@@ -1885,7 +1880,7 @@ class PHP_CRUD_API {
1885 1880
 			$multi = $post[0]=='[';
1886 1881
 			$contexts = $this->retrieveInputs($post);
1887 1882
 			if ($before) {
1888
-				$this->applyBeforeHandler(compact('action','database','tables','key','before'),$contexts);
1883
+				$this->applyBeforeHandler($action,$database,$tables[0],$key[0],$before,$contexts);
1889 1884
 			}
1890 1885
 			foreach ($contexts as $context) {
1891 1886
 				$input = $this->filterInputByFields($context,$fields[$tables[0]]);

BIN
data/blog.db View File


Loading…
Cancel
Save