public function beforeSave($insert) { // Only serialize complex values if (is_array($this->data) || is_object($this->data)) { $this->packed = true; $this->autoSerialize = true; $this->data = \bedezign\yii2\audit\components\Helper::compact($this->data); } return parent::beforeSave($insert); }
public function finalize() { if (in_array('response', $this->logVars)) { $entry = Audit::current()->getEntry(); if ($entry) { if (Yii::$app->response instanceof \yii\web\Response) { $data = Helper::compact(Yii::$app->response->headers, true); if ($data) { $entry->addData('response_headers', $data); } } } } }
public function finalize() { $this->end_time = microtime(true); $this->duration = $this->end_time - $this->start_time; $this->memory = memory_get_usage(); $this->memory_max = memory_get_peak_usage(); $response = \Yii::$app->response; if ($response instanceof \yii\web\Response) { $this->redirect = $response->headers->get('location'); $this->addData('Response Headers', Helper::compact($response->headers, true), 'response_headers'); } return $this->save(false, ['end_time', 'duration', 'memory', 'memory_max', 'redirect']); }