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:
2025-04-28 12:56:02 +02:00
parent 94507eb91c
commit d1f4b80255
2 changed files with 42 additions and 0 deletions
@@ -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