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

Use Singleton parent class app-wide? #4208

Closed
mattab opened this issue Oct 9, 2013 · 6 comments
Closed

Use Singleton parent class app-wide? #4208

mattab opened this issue Oct 9, 2013 · 6 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Oct 9, 2013

Now that we use php 5.3, maybe it's possible to have all singletons inherit a clean Singleton abstract. Currently having to write the getInstance function is lengthy.

maybe this solution: http://stackoverflow.com/questions/3972628/creating-a-singleton-base-class-in-php-5-3?answertab=votes#tab-top

Note: we have 53 singletons in Piwik!! (because all API are singleton for example + 18 singleton in core...)

@halfdan
Copy link
Member

halfdan commented Oct 9, 2013

Doing this would prevent all these classes from extending another class.

We should maybe also rethink some of these singletons: http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons

@mattab
Copy link
Member Author

mattab commented Oct 10, 2013

In 13b35fa: Refs #4208 Remove translate singleton

@mattab
Copy link
Member Author

mattab commented Oct 10, 2013

In b6a4d25: Refs #4208 Move Plugin classes to core/Plugin for clarity

@mattab
Copy link
Member Author

mattab commented Oct 10, 2013

In b9654b6: Refs #4208 Plugin classes moved

@mattab
Copy link
Member Author

mattab commented Oct 10, 2013

In c782b8c: Refs #4208 refactor all singletons except the hard ones (with custom getInstance()
(some tests failing)

@mattab
Copy link
Member Author

mattab commented Oct 10, 2013

In 7da0007: Refs #4208 refactor some singletons

@mattab mattab added this to the 2.0 - Piwik 2.0 milestone Jul 8, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
…th custom getInstance()

(some tests failing)
sabl0r pushed a commit to sabl0r/piwik that referenced this issue Sep 23, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

2 participants