Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local mods to Zend Framework should be subclassed #632

Closed
anonymous-matomo-user opened this issue Mar 26, 2009 · 6 comments
Closed

Local mods to Zend Framework should be subclassed #632

anonymous-matomo-user opened this issue Mar 26, 2009 · 6 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Milestone

Comments

@anonymous-matomo-user
Copy link

i have tried to use piwik in a zend framework project so i have copy the example on the [Calling the API From within PHP](http://dev.piwik.org/trac/wiki/API/CallingTechniques) page and paste it in a zf controller
after hacking the include_path to avoid ‘cannot redeclare class exception’ (see #631)

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
```

Matthieu said on the forum that’s because resetConfigArray() is a custom method from piwik, but now the classes are added from the standart library used for the whole project.
i suggest any custom method like this one to be moove in new classes extending the original classes (eg Zenwik_Db_Adpater)

while looking at this i also noticed that piwik is using Zend_Registry to store data throw the process.
Any user using already zf will surely use Zend_Registry too so every entry in it should be prefixed to avoid scope issue

```
Zend_Registry::set(‘piwik_config’,$config)
```

maybe something similar should be done for zend_session and zend_auth

PS : maybe same pb can happen with other third party librarys (smarty is used a lot too …)

@mattab
Copy link
Member

mattab commented Mar 26, 2009

(In 1030) – renaming all constants that were not prefixed by PIWIK_ refs #632

@robocoder
Copy link
Contributor

co-depends in #497

@robocoder
Copy link
Contributor

Adding resetConfigArray() to Zend_Db_Adapter_Abstract is much cleaner/simpler than subclassing all the adapters and changing the factory to use our subclassed adapters. I'll add a method_exists() check.

@robocoder
Copy link
Contributor

In [1453], check that resetConfigArray() method exists

@mattab
Copy link
Member

mattab commented Sep 8, 2009

I think we might be able to call _construct() with empty parameter, rather than having to keep the hack ->resetConfig()

I will investigate

@robocoder
Copy link
Contributor

In [1465], fixes #632 - move local mods to subclassed ZF classes; the duplication in Db/Mysqli.php and Db/Pdo/Mysql.php is unavoidable because PHP doesn't support multiple inheritance

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc.
Projects
None yet
Development

No branches or pull requests

3 participants