6.0.0-beta1
▾
Tasks
New Task
Search
Photos
Wiki
▾
Tickets
New Ticket
Search
dev.horde.org
Toggle Alerts Log
Help
8/10/25
H
istory
A
ttachments
C
omment
W
atch
Download
Comment on [#9282] Using SQL sessionhandler and SQL cache causes infinite recursion
*
Your Email Address
*
Spam protection
Enter the letters below:
. .. ..__ .___..__ |_/ | |[__) | [__) | \|__|| \ | |
Comment
> Spent some time on this tonight and I'm leaning toward the problem > being that logger and cache shouldn't be getting a full-fledged > Horde_Db_Adapter, or that Horde_Db_Adapter shouldn't include logging > and caching, but a higher-level object should. From the comments at > http://misko.hevery.com/2008/08/01/circular-dependency-in-constructors-and-dependency-injection/: > > @Peter, > > here is how I would attack you problem. > > class Database() implements DB; > class Logger(Database db); > class LoggingDatabase(Logger log, Database db) implements DB; > > DB rawDatabase = new Database(); > Logger log = new Logger(rowDatabase); > DB dbForTheRestoOfApplication = new LoggingDatabase(log, rowDatabase); > > There you go. LoggingDatabase logs the commands as they go by and > than delegate it on a class of the same interface. This is know as > chain of responsibility and it is my favorite design pattern. > > ... so, that seems clean, but will take a little work.
Attachment
Watch this ticket
N
ew Ticket
M
y Tickets
S
earch
Q
uery Builder
R
eports
Saved Queries
Open Bugs
Bugs waiting for Feedback
Open Bugs in Releases
Open Enhancements
Enhancements waiting for Feedback
Bugs with Patches
Enhancements with Patches
Release Showstoppers
Stalled Tickets
New Tickets
Horde 5 Showstoppers