PHP Classes

File: Config/Queries/GlobalDB/DELETE/users.php

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid   PHP Microservices Framework   Config/Queries/GlobalDB/DELETE/users.php   Download  
File: Config/Queries/GlobalDB/DELETE/users.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
Refactoring
__CONFIG__
Date: 21 days ago
Size: 1,406 bytes
 

Contents

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

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

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