PHP Classes

File: Config/Queries/GlobalDB/PATCH/disable/groups.php

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid   Open Swoole Microservices   Config/Queries/GlobalDB/PATCH/disable/groups.php   Download  
File: Config/Queries/GlobalDB/PATCH/disable/groups.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: 12 days ago
Size: 1,791 bytes
 

Contents

Class file image Download
<?php
namespace Microservices\Config\Queries\GlobalDB\PATCH\disable;

return [
   
'query' => "UPDATE `{$Env::$groups}` SET __SET__ WHERE __WHERE__",
   
'__CONFIG__' => [// [{payload/uriParams}, key/index, {$Constants::$REQUIRED}]
       
['uriParams', 'group_id', $Constants::$REQUIRED],
    ],
   
'__SET__' => [
       
//column => [payload|readOnlySession|uriParams|insertIdParams|{custom}, key|{value}],
       
'is_disabled' => ['custom', 'Yes'],
       
'updated_by' => ['readOnlySession', 'user_id'],
       
'updated_on' => ['custom', date('Y-m-d H:i:s')]
    ],
   
'__WHERE__' => [
       
'is_disabled' => ['custom', 'No'],
       
'is_deleted' => ['custom', 'No'],
       
'group_id' => ['payload', 'group_id']
    ],
   
'validate' => [
        [
           
'fn' => 'primaryKeyExist',
           
'fnArgs' => [
               
'table' => ['custom', $Env::$groups],
               
'primary' => ['custom', 'group_id'],
               
'id' => ['payload', 'group_id']
            ],
           
'errorMessage' => 'Invalid Group Id'
       
],
        [
           
'fn' => 'checkColumnValueExist',
           
'fnArgs' => [
               
'table' => ['custom', $Env::$groups],
               
'column' => ['custom', 'is_deleted'],
               
'columnValue' => ['custom', 'No'],
               
'primary' => ['custom', 'group_id'],
               
'id' => ['payload', 'group_id'],
            ],
           
'errorMessage' => 'Record is deleted'
       
],
        [
           
'fn' => 'checkColumnValueExist',
           
'fnArgs' => [
               
'table' => ['custom', $Env::$groups],
               
'column' => ['custom', 'is_disabled'],
               
'columnValue' => ['custom', 'No'],
               
'primary' => ['custom', 'group_id'],
               
'id' => ['payload', 'group_id'],
            ],
           
'errorMessage' => 'Record is already disabled'
       
]
    ]
];