public function buildFilterList(array $params) { $factory = new \App_ListFilter_FilterFactory(); $fields = AuditLogFilterFields::getWhiteList(); $factory->setWhiteList($fields); $filterList = $factory->constructFilter($params); $filterList->setResourceId(AuditLogFilterFields::getResourceId()); $filterList->setValidators(AuditLogFilterFields::getValidatorSpec()); return $filterList->isValid() ? $filterList : null; }
protected function _fakeWatcherAuditLog($model) { $params = $model->params; $params = array_intersect_key($params, array_fill_keys(AuditLogFilterFields::getWhiteList(), 1)); $filterList = AuditLogService::getInstance()->buildFilterList($params); $watcher = $this->getMapper()->constructWatcherToTransaction(); $watcher->entityType = 'report'; $txId = uniqid('report-'); $watcher->entityIds = array($txId); $watcher->params->reportType = "audit_log"; $watcher->params->params = $params; $watcher->params->fileName = "report-audit.csv"; $watcher->remove = strtotime(\App::config('reports.autoremove', "+1 year")); $this->createWatcher($watcher); $event = $this->getMapper()->constructEventToTransaction(); $event->entityType = 'report'; $event->entityId = $txId; WatcherService::getInstance()->publishEvent($event); return $watcher->reload(); }