K
K
KOS_MOS2012-03-07 23:03:13
Zend Framework
KOS_MOS, 2012-03-07 23:03:13

Adding Functionality to Zend Framework Classes

How to add a new method or override an existing one in some ZF class so that it is automatically picked up?
For example, I inherited from Zend_DB and added a new method, how can I use it? - the first thing that comes to mind is to instantiate your My_Zend_Db class and execute your method, while the rest of the application will use Zend_Db, and two connections to the database will most likely be established.

In general, how can I add my edits to Zend_Db without introducing a new class?

PS Strongly do not kick - I did not work with ZF before.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anatoly, 2012-03-08
@taliban

If you work only with tables then Zend_Db_Table::setDefaultAdapter($db); will help, otherwise look where the db instance is created and replace it.

D
Disturbed, 2012-03-08
@Disturbed

Depends on the situation - either inheritance or decorator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question