```
Add logging functionality for Licenze operations Implemented a LogLicenze model and extended LicenzeController to log insert, update, and delete actions. This improves traceability of changes performed on Licenze through the application. ```
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
class Application_Model_Resources_LogLicenze extends App_Model_Resource_Abstract {
|
||||
|
||||
protected $_name = 'log_licenze';
|
||||
protected $_primary = 'id';
|
||||
|
||||
protected $_defaultOrder = 'id';
|
||||
protected $_defaultTipoOrder = 'ASC';
|
||||
|
||||
/************** METODI SPECIALIZZATI *******************/
|
||||
|
||||
}
|
||||
@@ -20,5 +20,34 @@ class V1_LicenzeController extends App_Controller_Rest_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function afterInsertElement($data)
|
||||
{
|
||||
// Inserimento record di Log
|
||||
$this->inserimentoRecordDiLog($data, 'Inserimento');
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function afterUpdateElement($data)
|
||||
{
|
||||
$this->inserimentoRecordDiLog($data, 'Aggiornamento');
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function afterDeleteElement($id): void
|
||||
{
|
||||
$record = $this->_genericModel->getRecordById($this->_resourceName, $id);
|
||||
$this->inserimentoRecordDiLog($record, 'Eliminazione');
|
||||
}
|
||||
|
||||
private function inserimentoRecordDiLog($data, $op)
|
||||
{
|
||||
/*$this->_genericModel->insert('LogLicenze', [
|
||||
'Operazione' => $op,
|
||||
'Data' => date('Y-m-d H:i:s'),
|
||||
'Utente' => $this->_authInfo->getIdentity(),
|
||||
'Descrizione' => '',
|
||||
'IdElemento' => ''
|
||||
]);*/
|
||||
}
|
||||
|
||||
}//END CLASS
|
||||
|
||||
Reference in New Issue
Block a user