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. ```
54 lines
1.3 KiB
PHP
54 lines
1.3 KiB
PHP
<?php
|
|
|
|
class V1_LicenzeController extends App_Controller_Rest_Controller
|
|
{
|
|
|
|
public function init()
|
|
{
|
|
$this->_resourceName = 'Licenze';
|
|
parent::init();
|
|
}
|
|
|
|
//-----------------------------------------------
|
|
|
|
public function switchMethodFunction($method)
|
|
{
|
|
switch ($method) {
|
|
default:
|
|
$this->defaultGetList();
|
|
break;
|
|
}
|
|
}
|
|
|
|
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
|