Files
GestioneSpiaggia.it/application/modules/v1/controllers/LicenzeController.php
T
giacomo d1f4b80255 ```
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.
```
2025-04-28 12:56:02 +02:00

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