|
@@ -91,7 +91,7 @@ $api = new PHP_CRUD_API(array(
|
91
|
91
|
'tenancy_function'=>function($cmd,$db,$tab,$col) { return null; },
|
92
|
92
|
'input_sanitizer'=>function($cmd,$db,$tab,$col,$typ,$val) { return $val; },
|
93
|
93
|
'input_validator'=>function($cmd,$db,$tab,$col,$typ,$val,$ctx) { return true; },
|
94
|
|
- 'before'=>function($cmd,$db,$tab,$id,$in) { /* adjust array $in */ },
|
|
94
|
+ 'before'=>function(&$cmd,&$db,&$tab,&$id,&$in) { /* adjust array $in */ },
|
95
|
95
|
'after'=>function($cmd,$db,$tab,$id,$in,$out) { /* do something */ },
|
96
|
96
|
// configurable options
|
97
|
97
|
'allow_origin'=>'*',
|
|
@@ -762,6 +762,10 @@ PUT http://localhost/api.php/categories/2
|
762
|
762
|
Before any operation the 'before' function is called that allows you to do set some automatic fields.
|
763
|
763
|
Note that the 'inputs' parameter is writable and is an array. The array may contain NULL values on invalid JSON.
|
764
|
764
|
|
|
765
|
+## Soft delete
|
|
766
|
+
|
|
767
|
+The 'before' function allows modification of the request parameters and can (for instance) be used to implement soft delete behavior.
|
|
768
|
+
|
765
|
769
|
## Custom actions
|
766
|
770
|
|
767
|
771
|
After any operation the 'after' function is called that allows you to do some custom actions.
|