PHP Classes

File: Config/Queries/GlobalDB/PATCH/approve/connections.php

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid   PHP Microservices Framework   Config/Queries/GlobalDB/PATCH/approve/connections.php   Download  
File: Config/Queries/GlobalDB/PATCH/approve/connections.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Microservices Framework
Setup microservices apps with configuration arrays
Author: By
Last change: Refactoring
Date: 1 month ago
Size: 2,015 bytes
 

Contents

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

use
Microservices\App\Constants;
use
Microservices\App\Env;
use
Microservices\App\HttpRequest;

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