Search code examples
phpzend-frameworkzend-framework2zend-dbzend-db-table

What is the most suitable way to work with databases in Zend Framework?


I'm developing web application with Zend Framework. In the documentation it says ...

"Be aware though that the Table Data Gateway pattern can become limiting in larger systems."

  • What are the drawbacks of using Table Data Gateway ?
  • What is the most suitable way to handle database with Zend ?

Solution

  • Drawbacks of using Table Data Gateway is that it can limit you from writing complex queries. Custom queries such as UNION, SUB QUERY and also using WHERE clauses such as

     WHERE A OR (B AND C) OR D
    

    Best way to write complex queries is to write the complex query by hand. So the best way to execute them is using the Zend_Db_Adapter