Files
fmgapp/app/models/admin/ScalewayProcess.php

205 lines
3.7 KiB
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php declare(strict_types=1); namespace IR\App\Models\Admin; if (!defined('IR_START')) exit('<pre>No direct script access allowed</pre>');
/**
* @framework Wevads Framework
* @version 1.0
* @author Amine Idrissi <contact@iresponse.tech>
* @date 2019
* @name ScalewayProcess.php
*/
# orm
use IR\Orm\ActiveRecord as ActiveRecord;
# helpers
use IR\App\Helpers\AuditLog as AuditLog;
/**
* @name ScalewayProcess
* @description ScalewayProcess Model
*/
class ScalewayProcess extends ActiveRecord
{
/**
* @database
* @readwrite
*/
protected $_databaseKey = 'system';
/**
* @schema
* @readwrite
*/
protected $_schema = 'admin';
/**
* @table
* @readwrite
*/
protected $_table = 'scaleway_processes';
# columns
/**
* @column
* @readwrite
* @primary
* @indexed
* @autoincrement
* @type integer
* @nullable false
* @length
*/
protected $_id;
/**
* @column
* @readwrite
* @indexed
* @type text
* @nullable false
* @length 20
*/
protected $_status;
/**
* @column
* @readwrite
* @indexed
* @type text
* @nullable true
* @length 20
*/
protected $_process_id;
/**
* @column
* @readwrite
* @indexed
* @type integer
* @nullable false
* @length
*/
protected $_account_id;
/**
* @column
* @readwrite
* @type text
* @nullable false
* @length 200
*/
protected $_region;
/**
* @column
* @readwrite
* @type integer
* @nullable false
* @length
*/
protected $_nb_instances;
/**
* @column
* @readwrite
* @type text
* @nullable false
* @length
*/
protected $_domains;
/**
* @column
* @readwrite
* @type text
* @nullable false
* @length 100
*/
protected $_os;
/**
* @column
* @readwrite
* @type text
* @nullable false
* @length 100
*/
protected $_size;
/**
* @column
* @readwrite
* @type text
* @nullable false
* @length 10
*/
protected $_progress;
/**
* @column
* @readwrite
* @type integer
* @nullable true
* @length
*/
protected $_instances_created;
/**
* @column
* @readwrite
* @type integer
* @nullable true
* @length
*/
protected $_instances_installed;
/**
* @column
* @readwrite
* @type timestamp
* @nullable false
* @length
*/
protected $_start_time;
/**
* @column
* @readwrite
* @type timestamp
* @nullable true
* @length
*/
protected $_finish_time;
/**
* @name insert
* @description creates a record base on the primary key
* @access public
* @return integer
* @throws DatabaseException
*/
public function insert() : int
{
$this->_id = parent::insert();
# register audit log
AuditLog::registerLog($this->_id,'Hetzner Process','Instances Creation','Start');
return $this->_id;
}
/**
* @name delete
* @description creates a query object, only if the primary key property value is not empty, and executes the querys delete() method.
* @access public
* @return integer
*/
public function delete() : int
{
# register audit log
AuditLog::registerLog($this->_id,'Hetzner Process','Instances Termination','Start');
return parent::delete();
}
}