PHP Classes

File: Config/Queries/Auth/GlobalDB/DELETE/clients.php

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid (Sharma)   PHP Microservices Framework   Config/Queries/Auth/GlobalDB/DELETE/clients.php   Download  
File: Config/Queries/Auth/GlobalDB/DELETE/clients.php
Role: Auxiliary script
Content type: text/plain
Description: Configuration script
Class: PHP Microservices Framework
Setup microservices apps with configuration arrays
Author: By
Last change: Support for same col multiple time
Adding double underscore for fields that can be used in __SUB-QUERY__
Date: 12 days ago
Size: 1,466 bytes
 

 

Contents

Class file image Download
<?php
namespace Microservices\Config\Queries\Auth\GlobalDB\DELETE;

use
Microservices\App\Constants;
use
Microservices\App\DatabaseDataTypes;
use
Microservices\App\Env;

return [
   
'__QUERY__' => "UPDATE `{$Env::$clients}` SET __SET__ WHERE __WHERE__",
   
'__SET__' => [
        [
'column' => 'updated_by', 'fetchFrom' => 'userDetails', 'fetchFromValue' => 'user_id'],
        [
'column' => 'updated_on', 'fetchFrom' => 'custom', 'fetchFromValue' => date('Y-m-d H:i:s')],
    ],
   
'__WHERE__' => [
        [
'column' => 'is_deleted', 'fetchFrom' => 'custom', 'fetchFromValue' => 'No'],
        [
'column' => 'client_id', 'fetchFrom' => 'uriParams', 'fetchFromValue' => 'client_id', 'dataType' => DatabaseDataTypes::$INT]
    ],
   
'__VALIDATE__' => [
        [
           
'fn' => 'primaryKeyExist',
           
'fnArgs' => [
               
'table' => ['custom', Env::$clients],
               
'primary' => ['custom', 'client_id'],
               
'id' => ['payload', 'client_id', DatabaseDataTypes::$INT]
            ],
           
'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', DatabaseDataTypes::$INT],
            ],
           
'errorMessage' => 'Record is already deleted'
       
]
    ]
];