summaryrefslogtreecommitdiff
path: root/tests/code/proxy.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
commit059e0d95d0c28bc5060e87e146eaf7411f51bf90 (patch)
tree7c21ac432f16dde2329a0d5954d70711eceb48e6 /tests/code/proxy.php
parent26cd8ee99659ef1926c96a049c93645ffc9b169d (diff)
downloadgyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.gz
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.bz2
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.zip
skeleton commit; based on an anom project
Diffstat (limited to 'tests/code/proxy.php')
-rwxr-xr-xtests/code/proxy.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/code/proxy.php b/tests/code/proxy.php
new file mode 100755
index 0000000..c249c46
--- /dev/null
+++ b/tests/code/proxy.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * @param class: needs to be a valid (full if namespaced) class
+ * @param method: method to call
+ * @param args (array): an array of passed arguments into method call
+ * @param ttl (int): will be used in some cache service
+ */
+function proxy($class, $method, $args, $ttl)
+{
+ // ksort($args); // is not recursive, won't sort category keys
+ $key = $class .':'. $method .':'. json_encode(
+ $args,
+ JSON_UNESCAPED_LINE_TERMINATORS|JSON_UNESCAPED_UNICODE
+ );
+ $data = call_user_func_array([$class, $method], $args);
+ reply_json([
+ 'key' => $key,
+ 'cache' => sha1($key),
+ 'data' => $data
+ ]);
+}
+
+# proxy('app\models\market\ProductCategories_model','categoryProducts',
+# [
+# [ 'id'=>10100, 'Hierarchy' => '.10.10100' ], // pass category (needs Hierarchy)
+# 904 // pas store
+# ],
+# 100 // ttl
+# );
+
+proxy(app\models\market\ProductCategories_model::class,'categoryProducts',
+ [
+ [ 'id'=>10100, 'Hierarchy' => '.10.10100' ], // pass category (needs Hierarchy)
+ 904 // pas store
+ ],
+ 100 // ttl
+);
+