80 lines
2.5 KiB
PHP
80 lines
2.5 KiB
PHP
<?php namespace App\Models;
|
|
|
|
|
|
/*
|
|
|
|
CREATE TABLE IF NOT EXISTS `Spese` (
|
|
`spIDspesa` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Identificativo univoco della spesa',
|
|
`spIDcommessa` int(11) NOT NULL COMMENT 'Identificativo univoco della commessa a cui riferire la spesa',
|
|
`spIDlavoratore` int(11) NOT NULL COMMENT 'Identificativo univoco del lavoratore a cui riferire la spesa',
|
|
`spImporto` float NOT NULL DEFAULT '0' COMMENT 'Valore in euro della spesa.',
|
|
`spDaRimborsare` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'Indica se la spesa è da rimborsare perchè anticipata dal lavoratore o no',
|
|
`spDescrizione` text NOT NULL COMMENT 'Descrizione della spesa',
|
|
`spData` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Data in cui si è fatta la spesa',
|
|
PRIMARY KEY (`spIDspesa`),
|
|
KEY `FK_Spese-Commesse` (`spIDcommessa`),
|
|
KEY `FK_Spese-Lavoratori` (`spIDlavoratore`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1615 DEFAULT CHARSET=utf8 COMMENT='Tabella con tutti i log delle Spese da rimborsare.';
|
|
|
|
Fields:
|
|
Tab: Spese = ['spIDspesa', 'spIDcommessa', 'spIDlavoratore', 'spImporto', 'spDaRimborsare', 'spDescrizione', 'spData'];
|
|
|
|
*/
|
|
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
|
|
|
|
class Spese_Model extends Model{
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Property
|
|
|
|
|
|
protected $table = 'Spese';
|
|
protected $primaryKey = 'spIDspesa';
|
|
|
|
protected $returnType = 'App\Entities\Spesa';
|
|
//protected $returnType = 'array';
|
|
|
|
protected $allowedFields = ['spIDcommessa', 'spIDlavoratore', 'spImporto', 'spDaRimborsare', 'spDescrizione', 'spData'];
|
|
|
|
protected $useSoftDeletes = false;
|
|
protected $useTimestamps = false;
|
|
//protected $createdField = 'spCreatedAt';
|
|
//protected $updatedField = 'spUpdatedAt';
|
|
//protected $deletedField = 'spDeletedAt';
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Events
|
|
|
|
|
|
//protected $beforeInsert = ['beforeInsert'];
|
|
//protected $afterInsert = ['afterInsert'];
|
|
//protected $beforeUpdate = ['beforeUpdate'];
|
|
//protected $afterUpdate = ['afterUpdate'];
|
|
//protected $beforeDelete = ['beforeDelete'];
|
|
//protected $afterDelete = ['afterDelete'];
|
|
//protected $afterFind = ['afterFind'];
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
// Methods
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
|
|
|
|
}//class Spese_Model
|
|
|