Пример #1
0
 public function save(Log $log)
 {
     $data = array('table' => $log->getTable(), 'table_id' => $log->getTableId(), 'operation' => $log->getOperation(), 'user' => $log->getUser(), 'data' => $log->getData(), 'register_date' => date("Y-m-d H:i:s", time()));
     $id = (int) $log->getId();
     if ($id == 0) {
         $this->tableGateway->insert($data);
         return true;
     } else {
         return false;
     }
 }
Пример #2
0
 public function save(EventInterface $e)
 {
     $log = new Log();
     $logTable = $this->serviceManager->get("Security\\Model\\LogTable");
     $params = $e->getParams();
     $authenticationService = new AuthenticationService();
     $user = $authenticationService->getIdentity()->id;
     if (isset($params['id']) && !empty($params['id'])) {
         $log->setTableId($params['id']);
     }
     $log->setTable($params['table']);
     $log->setOperation($params['operation']);
     if (isset($params['data'])) {
         $log->setData($params['data']);
     }
     $log->setUser($user);
     $logTable->save($log);
 }