PHP Classes

File: Config/Queries/Auth/GlobalDB/PATCH/enable/groups.php

Recommend this page to a friend!
  Classes of Ramesh Narayan Jangid (Sharma)   PHP Microservices Framework   Config/Queries/Auth/GlobalDB/PATCH/enable/groups.php   Download  
File: Config/Queries/Auth/GlobalDB/PATCH/enable/groups.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: 11 days ago
Size: 2,041 bytes
 

 

Contents

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

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

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