PHP Classes

File: Config/Sql/Private/GlobalDB/PATCH/enable/customer.php

Recommend this page to a friend!
  Packages of Ramesh Narayan Jangid (Sharma)   Open Swoole Microservices   Config/Sql/Private/GlobalDB/PATCH/enable/customer.php   Download  
File: Config/Sql/Private/GlobalDB/PATCH/enable/customer.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: Open Swoole Microservices
Implement microservices using Open Swoole
Author: By
Last change: Refactoring
Date: 3 months ago
Size: 2,640 bytes
 

Contents

Class file image Download
<?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\Constant;
use Microservices\App\DatabaseServerDataType;
use Microservices\App\Env;
use Microservices\DatabaseTable;

return [
    '__SQL__' => "UPDATE `{$Env::$customerTable}` SET __SET__ WHERE __WHERE__",
    '__SET__' => [
        [
            'column' => 'is_disabled',
            'activeRequestDataKey' => 'custom',
            'activeRequestDataKeySubKey' => Constant::$NO
        ],
        [
            'column' => 'updated_by',
            'activeRequestDataKey' => 'userData',
            'activeRequestDataKeySubKey' => DatabaseTable::$customerUserPrimaryKey
        ],
        [
            'column' => 'updated_on',
            'activeRequestDataKey' => 'custom',
            'activeRequestDataKeySubKey' => date(format: 'Y-m-d H:i:s')
        ]
    ],
    '__WHERE__' => [
        [
            'column' => 'is_disabled',
            'activeRequestDataKey' => 'custom',
            'activeRequestDataKeySubKey' => Constant::$YES
        ],
        [
            'column' => 'is_deleted',
            'activeRequestDataKey' => 'custom',
            'activeRequestDataKeySubKey' => Constant::$NO
        ],
        [
            'column' => DatabaseTable::$customerPrimaryKey,
            'activeRequestDataKey' => 'payload',
            'activeRequestDataKeySubKey' => 'id',
            'dataType' => DatabaseServerDataType::$INT
        ]
    ],
    '__VALIDATE__' => [
        [
            'function' => 'primaryKeyExist',
            'functionArgs' => [
                'table' => ['custom', Env::$customerTable],
                'primary' => ['custom', DatabaseTable::$customerPrimaryKey],
                'id' => ['payload', 'id', DatabaseServerDataType::$INT]
            ],
            'errorMessage' => 'Invalid Customer Id'
        ],
        [
            'function' => '_checkColumnValueExist',
            'functionArgs' => [
                'table' => ['custom', Env::$customerTable],
                'column' => ['custom', 'is_deleted'],
                'columnValue' => ['custom', Constant::$NO],
                'primary' => ['custom', DatabaseTable::$customerPrimaryKey],
                'id' => ['payload', 'id', DatabaseServerDataType::$INT],
            ],
            'errorMessage' => 'Record is deleted'
        ],
        [
            'function' => '_checkColumnValueExist',
            'functionArgs' => [
                'table' => ['custom', Env::$customerTable],
                'column' => ['custom', 'is_disabled'],
                'columnValue' => ['custom', Constant::$YES],
                'primary' => ['custom', DatabaseTable::$customerPrimaryKey],
                'id' => ['payload', 'id', DatabaseServerDataType::$INT],
            ],
            'errorMessage' => 'Record is already enabled'
        ]
    ]
];