예제 #1
0
 /**
  * Resolves the canonical column types of the audit table columns.
  */
 protected function resolveCanonicalAuditColumns()
 {
     if (empty($this->config['audit_columns'])) {
         $this->auditColumnsMetadata = new TableColumnsMetadata();
     } else {
         $schema = $this->config['database']['audit_schema'];
         $tableName = '_TMP_' . uniqid();
         AuditDataLayer::createTemporaryTable($schema, $tableName, $this->config['audit_columns']);
         $columns = AuditDataLayer::getTableColumns($schema, $tableName);
         AuditDataLayer::dropTemporaryTable($schema, $tableName);
         foreach ($this->config['audit_columns'] as $audit_column) {
             $key = StaticDataLayer::searchInRowSet('column_name', $audit_column['column_name'], $columns);
             if (isset($audit_column['value_type'])) {
                 $columns[$key]['value_type'] = $audit_column['value_type'];
             }
             if (isset($audit_column['expression'])) {
                 $columns[$key]['expression'] = $audit_column['expression'];
             }
         }
         $this->auditColumnsMetadata = new TableColumnsMetadata($columns, 'AuditColumnMetadata');
     }
 }