Search code examples
phppostgresqldoctrine-ormzend-framework2tablegateway

Alternative to TableGateway for Zend Framework 2


I'm using Zend framework 2 to create web pages.

Through TableGateway I'm accessing my PostgreSQL DB.

Is there any alternative to TableGateway that can be used effectively in Zend framework 2, with easy-to-use documentation and stuff?

I'm trying to get away from Doctrine 2 (unless you could convince me otherwise).

Any help would be appretiated.


Solution

  • As I commented, I used 3 ways to handle data access.

    • TableGateway patter is ok but it's not easy to maintain for larger applications.

    • Another commonly used pattern is the data mapper pattern, for this you can use AbstractDbMapper and hydrator for mapping. AbstracDbMapper Link

    • Entity pattern, like Doctrine

    I finally decided to use doctrine basically cause is very easy to maintain and you can save some hours of code, but if you don't want to use doctrine i think that Data Mapper Pattern is the best option.