diff options
author | mattab <matthieu.aubry@gmail.com> | 2014-04-12 06:21:07 +0400 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2014-04-12 06:21:07 +0400 |
commit | 8922de6ad8995d020c04b6709ac160fdb42e0201 (patch) | |
tree | 9baba84e1b0b82ef479a02cdd9010984365ad348 /plugins/Events/API.php | |
parent | 238f49720c5787890c952cf14ac86c6ad4aae4bf (diff) |
Really fix notice
Diffstat (limited to 'plugins/Events/API.php')
-rw-r--r-- | plugins/Events/API.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/plugins/Events/API.php b/plugins/Events/API.php index 23aa5bdc59..0be6037596 100644 --- a/plugins/Events/API.php +++ b/plugins/Events/API.php @@ -55,7 +55,7 @@ class API extends \Piwik\Plugin\API /** * @ignore */ - public function getActionToLoadSubtables($apiMethod, $secondaryDimension) + public function getActionToLoadSubtables($apiMethod, $secondaryDimension = false) { $recordName = $this->getRecordNameForAction($apiMethod, $secondaryDimension); $apiMethod = array_search( $recordName, $this->mappingApiToRecord ); @@ -77,15 +77,17 @@ class API extends \Piwik\Plugin\API protected function getRecordNameForAction($apiMethod, $secondaryDimension = false) { if (empty($secondaryDimension)) { - $record = $this->mappingApiToRecord[$apiMethod]; - - if(!is_array($record)) { - return $record; - } $secondaryDimension = $this->getDefaultSecondaryDimension($apiMethod); } - - return $this->mappingApiToRecord[$apiMethod][$secondaryDimension]; + $record = $this->mappingApiToRecord[$apiMethod]; + if(!is_array($record)) { + return $record; + } + // when secondaryDimension is incorrectly set + if(empty($record[$secondaryDimension])) { + return key($record); + } + return $record[$secondaryDimension]; } /** @@ -96,6 +98,9 @@ class API extends \Piwik\Plugin\API public function getSecondaryDimensions($apiMethod) { $records = $this->mappingApiToRecord[$apiMethod]; + if(!is_array($records)) { + return false; + } return array_keys($records); } |