79 lines
2.4 KiB
PHP
79 lines
2.4 KiB
PHP
<?php namespace App\Models;
|
|||
|
|
|
||
|
|
|
||
|
|
/*
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS `Clienti` (
|
||
|
|
`clIDcliente` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Identificativo univoco del cliente',
|
||
|
|
`clNome` varchar(32) NOT NULL COMMENT 'Nome, per riferimento interno, del cliente',
|
||
|
|
`clInfo` text NOT NULL COMMENT 'Informazioni sul cliente che vogliamo storicizzare',
|
||
|
|
`clCreatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp di inserimento del record nel database',
|
||
|
|
`clUpdatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Timestamp in cui il record è stato aggiornato',
|
||
|
|
`clDeletedAt` timestamp NULL DEFAULT NULL COMMENT 'Timestamp in cui il record è stato virtualmente cancellato (senza delete reale)',
|
||
|
|
PRIMARY KEY (`clIDcliente`),
|
||
|
|
UNIQUE KEY `clIDcliente` (`clIDcliente`),
|
||
|
|
UNIQUE KEY `clNome` (`clNome`)
|
||
|
|
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='Elenco dei Clienti della CSiCo';
|
||
|
|
|
||
|
|
Fields:
|
||
|
|
Tab: Clienti = ['clIDcliente', 'clNome', 'clInfo', 'clCreatedAt', 'clUpdatedAt', 'clDeletedAt'];
|
||
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
|
||
|
|
use CodeIgniter\Model;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
class Clienti_Model extends Model{
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
// Property
|
||
|
|
|
||
|
|
|
||
|
|
protected $table = 'Clienti';
|
||
|
|
protected $primaryKey = 'clIDcliente';
|
||
|
|
|
||
|
|
//protected $returnType = 'App\Entities\Cliente';
|
||
|
|
protected $returnType = 'array';
|
||
|
|
|
||
|
|
protected $allowedFields = ['clNome', 'clInfo'];
|
||
|
|
|
||
|
|
protected $useSoftDeletes = true;
|
||
|
|
protected $useTimestamps = true;
|
||
|
|
protected $createdField = 'clCreatedAt';
|
||
|
|
protected $updatedField = 'clUpdatedAt';
|
||
|
|
protected $deletedField = 'clDeletedAt';
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
// Events
|
||
|
|
|
||
|
|
|
||
|
|
//protected $beforeInsert = ['beforeInsert'];
|
||
|
|
//protected $afterInsert = ['afterInsert'];
|
||
|
|
//protected $beforeUpdate = ['beforeUpdate'];
|
||
|
|
//protected $afterUpdate = ['afterUpdate'];
|
||
|
|
//protected $beforeDelete = ['beforeDelete'];
|
||
|
|
//protected $afterDelete = ['afterDelete'];
|
||
|
|
//protected $afterFind = ['afterFind'];
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
// Methods
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//--------------------------------------------------------------------
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}//class Clienti_Model
|
||
|
|
|
||
|
|
|