Index: trunk/extensions/MetricsReporting/ApiAnalyticsBase.php |
— | — | @@ -86,11 +86,11 @@ |
87 | 87 | $result = $this->getResult(); |
88 | 88 | $data = array(); |
89 | 89 | |
90 | | - $fields = $this->getQueryFields(); |
| 90 | + $fields = array_map( array( $this, 'getColumnName' ), $query['fields'] ); |
91 | 91 | foreach( $res as $row ) { |
92 | 92 | $item = array(); |
93 | 93 | foreach( $fields as $field ) { |
94 | | - $item[$field] = $row->$$field; |
| 94 | + $item[$field] = $row->$field; |
95 | 95 | } |
96 | 96 | $data[] = $item; |
97 | 97 | } |
— | — | @@ -99,6 +99,15 @@ |
100 | 100 | $result->addValue( 'metric', $this->getModuleName(), $data ); |
101 | 101 | } |
102 | 102 | |
| 103 | + private function getColumnName( $col ) { |
| 104 | + $pos = strpos( $col, '.' ); |
| 105 | + |
| 106 | + if ( !$pos ) { |
| 107 | + return $col; |
| 108 | + } |
| 109 | + return substr( $col, $pos + 1 ); |
| 110 | + } |
| 111 | + |
103 | 112 | protected abstract function getQueryInfo(); |
104 | 113 | |
105 | 114 | protected abstract function getQueryFields(); |