Piwik inside a zend framework project


(Tom67) #1

hi

still into piwik for my new project, i had a problem trying to use the api programaticaly using the Calling from php Exemple

  • first i got class redeclaration errors cause when using piwki files into my zf project 2 identical files in different folder where included (like myapp/lib/Zend/Exception.php and myapp/lib/piwik/libs/Zend/Exception.php). This could be solved adding my own include_path on the top the files are no longer loaded from piwik/libs but from my own Zend folder.
    maybe a config entry “overwrite_ZF_folder” could be used …

  • then i got the following error :

Fatal error: Call to undefined method Zend_Db_Adapter_Pdo_Mysql::resetConfigArray() in D:\WORK\SITES WEB\JC2\SRC\lib\piwik\core\Piwik.php on line 1184
--> Piwik::createDatabaseObject( )    ..\FrontController.php:234

i have notice that piwik is using Zend_Registry to store some datas and i think that can be one of the sources of the error, cause of course i use Zend_Registry in my application too, and of course i’ve stored my config from ini file in an entry named … config ! style_emoticons/<#EMO_DIR#>/laugh.gif
adding a ‘piwik_’ prefix to some variables may solve a few things …
as ZF and piwik are becoming quite popular it would be nice that they work fine together ! it is not a real issue for me now but i just wanted to let you know


(Matthieu Aubry) #2

[quote=Tom67 @ Mar 25 2009, 11:03 PM]hi

still into piwik for my new project, i had a problem trying to use the api programaticaly using the Calling from php Exemple

  • first i got class redeclaration errors cause when using piwki files into my zf project 2 identical files in different folder where included (like myapp/lib/Zend/Exception.php and myapp/lib/piwik/libs/Zend/Exception.php). This could be solved adding my own include_path on the top the files are no longer loaded from piwik/libs but from my own Zend folder.
    maybe a config entry “overwrite_ZF_folder” could be used …

  • then i got the following error :

Fatal error: Call to undefined method Zend_Db_Adapter_Pdo_Mysql::resetConfigArray() in D:\WORK\SITES WEB\JC2\SRC\lib\piwik\core\Piwik.php on line 1184
--> Piwik::createDatabaseObject( )    ..\FrontController.php:234

i have notice that piwik is using Zend_Registry to store some datas and i think that can be one of the sources of the error, cause of course i use Zend_Registry in my application too, and of course i’ve stored my config from ini file in an entry named … config ! style_emoticons/<#EMO_DIR#>/laugh.gif
adding a ‘piwik_’ prefix to some variables may solve a few things …
as ZF and piwik are becoming quite popular it would be nice that they work fine together ! it is not a real issue for me now but i just wanted to let you know[/quote]

for 1- please create a ticket with an elegant suggestion to solve it
for 2 - resetConfigArray() is a custom piwik hack made on the zend class. we’d like to get rid of it anyway so please create a ticket with your bug report.