Adjust before handler to facilitate #130
This commit is contained in:
parent
7d3968ce50
commit
272f5759f4
2 changed files with 2 additions and 7 deletions
9
api.php
9
api.php
|
|
@ -1134,13 +1134,8 @@ class PHP_CRUD_API {
|
|||
return $values;
|
||||
}
|
||||
|
||||
protected function applyBeforeHandler($parameters,&$inputs) {
|
||||
$callback = $parameters['before'];
|
||||
protected function applyBeforeHandler(&$action,&$database,&$table,&$id,&$callback,&$inputs) {
|
||||
if (is_callable($callback,true)) {
|
||||
$action = $parameters['action'];
|
||||
$database = $parameters['database'];
|
||||
$table = $parameters['tables'][0];
|
||||
$id = $parameters['key'][0];
|
||||
$callback($action,$database,$table,$id,$inputs);
|
||||
}
|
||||
}
|
||||
|
|
@ -1885,7 +1880,7 @@ class PHP_CRUD_API {
|
|||
$multi = $post[0]=='[';
|
||||
$contexts = $this->retrieveInputs($post);
|
||||
if ($before) {
|
||||
$this->applyBeforeHandler(compact('action','database','tables','key','before'),$contexts);
|
||||
$this->applyBeforeHandler($action,$database,$tables[0],$key[0],$before,$contexts);
|
||||
}
|
||||
foreach ($contexts as $context) {
|
||||
$input = $this->filterInputByFields($context,$fields[$tables[0]]);
|
||||
|
|
|
|||
BIN
data/blog.db
BIN
data/blog.db
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue