News Feed
Sections




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

MaltBlue.com:
Zend Framework 2 - Hydrators, Models and the TableGateway Pattern
May 15, 2013 @ 11:13:46

Matthew Setter has written up a post to his site that continues his look at the features of Zend Framework 2. This time he's looking specifically at hydrators, models and the table gateways and their use in connecting your application with a database.

One set of features has really been helping me of late ones that really have me smiling; these are: Hydrators, Models and Table Gateways. If you're new to ZF2 or database interaction with frameworks, then you're in a perfect position as today's post will be giving you a good introduction to the basics of using both together.

He starts with a look back at how it all was done in ZF1 and shows how using these three components makes for an even better system, allowing the model to be completely data-source agnostic. His examples start with the table gateway class, showing how to connect it with a "users" table. From there he adds in the model (with an "exchangeArray" method) and a hydrator that maps the table columns to the properties on the entity. He shows how to add this setup to the service configuration and its use in a controller, returning a full list of the records in the "user" table.

0 comments voice your opinion now!
zendframework2 tutorial hydrator tablegateway model database

Link: http://www.maltblue.com/tutorial/zendframework2-hydrators-models-tablegateway-pattern

blog comments powered by Disqus

Similar Posts

Rob Allen's Blog: Accessing your configuration data in application.ini

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

PHPMaster.com: Letís Talk: Efficient Communication for PHP and Android, Part 1

DevShed: Introducing the Composite Pattern in PHP 5

PHPBuilder.com: Transfer Data via Multiple Protocols with Libcurl


Community Events

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


introduction library laravel laravel5 list podcast extension community opinion series voicesoftheelephpant version example php7 security interview api language framework release

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