News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Mastering Zend Framework:
Building and Executing SQL Queries In Zend
April 08, 2014 @ 12:18:17

The Mastering Zend Framework site (from Matthew Setter) has a new post today showing you how to execute SQL queries directly in a Zend Framework v2 application.

Whilst there are many ways for building and executing SQL queries in Zend Framework 2, the two that I usually use, and which are also used in the ZF2 manual, are closures and the selectWith function. I previously wrote a three part series, showing how to get started using the ZendDbSql classes with Zend Framework 2, but I didn't cover how to actually run them. So in today's tutorial, let's do that.

He gives examples of these two methods starting with closures in a "tableGateway" select call. He shows how to add on parts of the query like "wheres" and an "order by" as well as some basic formatting. He then gets into the "selectWith" examples, showing the same criteria just added a different way. He also includes an example of the "tableGateway" objects used for the examples and how they're configured.

0 comments voice your opinion now!
sql query zendframework2 execute query build tablegateway

Link: http://www.masterzendframework.com/php/building-and-executing-sql-queries-in-zend

blog comments powered by Disqus

Similar Posts

Mike Borozdin's Blog: Is PHPLinq As Cool As Real LINQ?

Kevin Schroeder's Blog: My first stab at the Dependency Injection Container in Zend Framework 2

MaltBlue.com: 3 Simple Ideas for Improving Zend Framework Performance

Sebastian Bergmann: Using PHPUnit from a PHP Archive (PHAR)

Kevin Schroeder's Blog: ZF2 Dependency Injection: Managing Configuration - Part 2


Community Events





Don't see your event here?
Let us know!


configure opinion introduction code framework podcast threedevsandamaybe release series language install experience testing laravel list interview symfony2 community unittest developer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework