Doctrine DBAL is a fantastic extension to PDO but writing CRUD code for simple 1 to 1 mappings still represents a time sink. This component implements Table Gateway on top of Doctrine DBAL and is heavily inspired by zf2 Table Gateway.
What are the benefits?
- Using metadata the gateway will convert values, for example DateTime is converted to a stamps and the stamp is converted back to DateTime.
- Events system, e.g pre_select , post_delete , pre_insert... based around the symfony2 event dispatcher.
- Query Logger using Monolog, you would normally write this yourself.
- Builder can map records to entities, you could build an active record on top of this gateway.
- Supply a collection class and it will load them into it.
- Fluid interface for running selects, inserts, updates and deletes.
- Faster than manual CRUD.
Whats are the cons?
- Loose auto-completion in your IDE, for subclasses, only get it for the bases classes.
- Overhead a little more memory and extra method calls.