phpzend-framework2zend-dbzend-db-table

Modify all queries in Zend\Db (add where)


I need to modify all queries that are executed through Zend\Db before sending them to DB.

Basically it needs to add additional WHERE statement to all selects, updates and deletes and additional column and value in inserts.

I was thinking about writing my own TableGateway feature for that, the problem is that I would like to avoid being restricted to TableGateway alone and have this functionality while using Zend\Db\Adapter and TableGateway at the same time.


Solution

  • I have ended up writing custom db adapter that handles all the logic. I'll probably share it as an open source if I'll have a time to clean up the code.