I have an \Piwik\Plugin\API class with a method that makes a Db::fetchAssoc call. This call works fine when the source request is made from a browser. However, when trying to reuse this same method during a onNewVisit method, I receive a fatal error message.
[Tue Sep 29 10:38:15.200845 2015] [:error] [pid 11493] [client ::1:48504] PHP Fatal error: Call to undefined method Piwik\\Tracker\\Db\\Pdo\\Mysql::fetchAssoc() in /var/www/html/piwik/core/Db.php on line 265
[Tue Sep 29 10:38:15.200868 2015] [:error] [pid 11493] [client ::1:48504] PHP Stack trace:
[Tue Sep 29 10:38:15.200884 2015] [:error] [pid 11493] [client ::1:48504] PHP 1. {main}() /var/www/html/piwik/piwik.php:0
[Tue Sep 29 10:38:15.200889 2015] [:error] [pid 11493] [client ::1:48504] PHP 2. Piwik\\Tracker->main() /var/www/html/piwik/piwik.php:67
[Tue Sep 29 10:38:15.200893 2015] [:error] [pid 11493] [client ::1:48504] PHP 3. Piwik\\Tracker->track() /var/www/html/piwik/core/Tracker.php:98
[Tue Sep 29 10:38:15.200898 2015] [:error] [pid 11493] [client ::1:48504] PHP 4. Piwik\\Plugins\\BulkTracking\\Tracker\\Handler->process() /var/www/html/piwik/core/Tracker.php:121
[Tue Sep 29 10:38:15.200902 2015] [:error] [pid 11493] [client ::1:48504] PHP 5. Piwik\\Tracker->trackRequest() /var/www/html/piwik/plugins/BulkTracking/Tracker/Handler.php:46
[Tue Sep 29 10:38:15.200906 2015] [:error] [pid 11493] [client ::1:48504] PHP 6. Piwik\\Tracker\\Visit->handle() /var/www/html/piwik/core/Tracker.php:139
[Tue Sep 29 10:38:15.200910 2015] [:error] [pid 11493] [client ::1:48504] PHP 7. Piwik\\Tracker\\Visit->handleNewVisit() /var/www/html/piwik/core/Tracker/Visit.php:229
[Tue Sep 29 10:38:15.200913 2015] [:error] [pid 11493] [client ::1:48504] PHP 8. Piwik\\Tracker\\Visit->triggerHookOnDimensions() /var/www/html/piwik/core/Tracker/Visit.php:332
[...snip...]
[Tue Sep 29 10:38:15.200941 2015] [:error] [pid 11493] [client ::1:48504] PHP 13. Piwik\\Db::fetchAssoc() /var/www/html/piwik/plugins/[CustomPlugin]/API.php:62
It looks like the problem is Tracker using different DB classes than Core Piwik does. Can this be fixed by making a configuration change?
Piwik version 2.14.3