<?php
/**
* API Query config
* php version 8.3
*
* @category API_Query_Config
* @package Openswoole-Microservices
* @author Ramesh N. Jangid (Sharma) <polygon.co.in@gmail.com>
* @copyright © 2026 Ramesh N. Jangid (Sharma)
* @license MIT https://opensource.org/license/mit
* @link https://github.com/polygoncoin/Openswoole-Microservices
* @since Class available since Release 1.0.0
*/
use Microservices\App\DatabaseServerDataType;
return [
'__QUERY__' => "UPDATE `{$this->http->req->s['customerData']['userTable']}` SET __SET__ WHERE __WHERE__",
'__SET__' => [
[
'column' => 'firstname',
'fetchFrom' => 'payload',
'fetchFromData' => 'firstname'
],
[
'column' => 'lastname',
'fetchFrom' => 'payload',
'fetchFromData' => 'lastname'
],
[
'column' => 'email',
'fetchFrom' => 'payload',
'fetchFromData' => 'email'
],
[
'column' => 'username',
'fetchFrom' => 'payload',
'fetchFromData' => 'username'
],
[
'column' => 'password_hash',
'fetchFrom' => 'function',
'fetchFromData' => function($session) {
if (
isset($session['payload'])
&& isset($session['payload']['password'])
) {
return password_hash(
password: $session['payload']['password'],
algo: PASSWORD_DEFAULT
);
}
}
]
],
'__WHERE__' => [
[
'column' => 'is_deleted',
'fetchFrom' => 'custom',
'fetchFromData' => 'No'
],
[
'column' => 'id',
'fetchFrom' => 'routeParamArr',
'fetchFromData' => 'id',
'dataType' => DatabaseServerDataType::$PrimaryKey
]
],
'__SUB-QUERY__' => [
'address' => [
'__QUERY__' => 'UPDATE `address` SET __SET__ WHERE __WHERE__',
'__SET__' => [
[
'column' => 'address',
'fetchFrom' => 'payload',
'fetchFromData' => 'address'
]
],
'__WHERE__' => [
[
'column' => 'is_deleted',
'fetchFrom' => 'custom',
'fetchFromData' => 'No'
],
[
'column' => 'id',
'fetchFrom' => 'payload',
'fetchFromData' => 'id',
'dataType' => DatabaseServerDataType::$PrimaryKey
],
],
]
],
'__VALIDATE__' => [
[
'function' => 'primaryKeyExist',
'functionArgs' => [
'table' => ['custom', $this->http->req->s['customerData']['userTable']],
'primary' => ['custom', 'id'],
'id' => ['routeParamArr', 'id']
],
'errorMessage' => 'Invalid registration id'
],
],
'useHierarchy' => true,
'idempotentWindow' => 10
];
|