80 lines
2.7 KiB
PHP
80 lines
2.7 KiB
PHP
<?php namespace App\Models;
|
|
|
|
|
|
/*
|
|
|
|
CREATE TABLE IF NOT EXISTS `CreditCards` (
|
|
`ccIDcard` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Identificativo univoco della carta di credito aziendale',
|
|
`ccNumero` varchar(20) NOT NULL COMMENT 'Numero nella carta',
|
|
`ccDescrizione` text NOT NULL COMMENT 'Descrizione della carta per riferimento interno CSiCo',
|
|
`ccScadeIl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data di scadenza della carta',
|
|
`ccPIN` varchar(6) NOT NULL COMMENT 'PIN della carta',
|
|
`ccCreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp di inserimento del record nel database',
|
|
`ccUpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp in cui il record è stato aggiornato',
|
|
`ccStato` enum('Disponibile','Occupata','Scaduta') NOT NULL DEFAULT 'Disponibile' COMMENT 'Stato della carta di credito, riassume gli eventi',
|
|
`ccDeletedAt` timestamp NULL DEFAULT NULL COMMENT 'Timestamp in cui il record è stato virtualmente cancellato (senza delete reale)',
|
|
PRIMARY KEY (`ccIDcard`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='Tabella con tutte le carte di credito della CSiCo.';
|
|
|
|
Fields:
|
|
Tab: CreditCards = ['ccIDcard', 'ccNumero', 'ccDescrizione', 'ccScadeIl', 'ccPIN', 'ccCreatedAt', 'ccUpdatedAt', 'ccStato', 'ccDeletedAt'];
|
|
|
|
*/
|
|
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
|
|
|
|
class CreditCards_Model extends Model {
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Property
|
|
|
|
|
|
protected $table = 'CreditCards';
|
|
protected $primaryKey = 'ccIDcard';
|
|
|
|
protected $returnType = 'App\Entities\CreditCard';
|
|
//protected $returnType = 'array';
|
|
|
|
protected $allowedFields = ['ccNumero', 'ccDescrizione', 'ccScadeIl', 'ccPIN', 'ccStato'];
|
|
|
|
protected $useSoftDeletes = true;
|
|
protected $useTimestamps = true;
|
|
protected $createdField = 'ccCreatedAt';
|
|
protected $updatedField = 'ccUpdatedAt';
|
|
protected $deletedField = 'ccDeletedAt';
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Events
|
|
|
|
|
|
//protected $beforeInsert = ['beforeInsert'];
|
|
//protected $afterInsert = ['afterInsert'];
|
|
//protected $beforeUpdate = ['beforeUpdate'];
|
|
//protected $afterUpdate = ['afterUpdate'];
|
|
//protected $beforeDelete = ['beforeDelete'];
|
|
//protected $afterDelete = ['afterDelete'];
|
|
//protected $afterFind = ['afterFind'];
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Methods
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
}//class CreditCards_Model
|