0

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.

2 Answers 2

1

You can have a look at some of the events dispatched from the table gateway if that make sense in your context: http://framework.zend.com/apidoc/2.4/namespaces/Zend.Db.TableGateway.Feature.EventFeature.html

There is a preSelect event that is triggered and which you can probably listen to.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks Thomas, the problem is that all Features are for TableGateway only, I need to have such flexibility of altering queries on an adapter level.
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.