PHP Classes

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

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid   PHP Microservices Framework   Config/Queries/GlobalDB/PATCH/approve/clients.php   Download  
File: Config/Queries/GlobalDB/PATCH/approve/clients.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: Refactor
Date: 9 days ago
Size: 1,877 bytes
 

Contents

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

use
Microservices\App\Constants;

return [
   
'query' => "UPDATE `{$Env::$clients}` SET __SET__ WHERE __WHERE__",
   
'__CONFIG__' => [// [{payload/uriParams}, key/index, {Constants::$REQUIRED}]
       
['uriParams', 'client_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'],
       
'client_id' => ['payload', 'client_id']
    ],
   
'validate' => [
        [
           
'fn' => 'primaryKeyExist',
           
'fnArgs' => [
               
'table' => ['custom', Env::$clients],
               
'primary' => ['custom', 'client_id'],
               
'id' => ['payload', 'client_id']
            ],
           
'errorMessage' => 'Invalid Client Id'
       
],
        [
           
'fn' => 'checkColumnValueExist',
           
'fnArgs' => [
               
'table' => ['custom', Env::$clients],
               
'column' => ['custom', 'is_deleted'],
               
'columnValue' => ['custom', 'No'],
               
'primary' => ['custom', 'client_id'],
               
'id' => ['payload', 'client_id'],
            ],
           
'errorMessage' => 'Record is deleted'
       
],
        [
           
'fn' => 'checkColumnValueExist',
           
'fnArgs' => [
               
'table' => ['custom', Env::$clients],
               
'column' => ['custom', 'is_approved'],
               
'columnValue' => ['custom', 'No'],
               
'primary' => ['custom', 'client_id'],
               
'id' => ['payload', 'client_id'],
            ],
           
'errorMessage' => 'Record is already approved'
       
]
    ]
];