News Feed
Sections




News Archive
feed this:

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

Till Klampaeckel's Blog:
Iterating over a table (with Zend_Db_Table and Zend_Paginator)
October 12, 2011 @ 11:01:44

Till Klampaeckel has a new post today looking at a solution for a common need - paginating through results as pulled from a database. With the help of the Zend_Db_Table and Zend_Paginator components of the Zend Framework it's a simple matter of passing the results into the Paginator and asking for a certain page.

So frequently, I need to run small data migrations or transformations. Especially on the way to Doctrine, there's a lot to clean-up in a database which has been used and evolved over five years or so.

Code snippets are included to define a class for the table, extending Zend_Db_Table_Abstract, and a new Zend_Paginator_Adapter_DbTableSelect object to create the paginated results. After that, it's as simple as setting the number of items per page and asking for a certain page. There's even a quick bit about being able to edit the rows inside the paginator directly (they're just Zend_Db_Table_Row records).

0 comments voice your opinion now!
tutorial iterate table zendframework zenddbtable zendpaginator


Ralph Schindler's Blog:
Composite Rowsets For Many-To-Many Relationships Via Zend_Db_Table
November 16, 2010 @ 11:08:24

Ralph Schindler has posted a handy tutorial (along with some helpful code) to his blog today about handling many-to-many composite rowset relationships with the Zend_Db component of the Zend Framework.

One of the hardest problems to solve when developing an ORM of any complexity is in deciding how to handle the retrieval of rows that satisfy a many-to-many relationship, also known as a M:N relationship. [...] To model M:N relationships, database developers must get creative. By employing the use of a "3rd party", and by utilizing foreign keys that model a 1:N relationship, database developers can model a M:N relationship.

He looks at the Zend_Db_Table_Row class of the framework and how it works with these junction tables and how it has an issue where it returns the junction table columns too. A fix was released (in 1.10.2) for the framework to work correctly. Unfortunately, this also left those using the method out in the cold. So, Ralph has created his own workaround called a composite rowset. He includes an example snippet to give you an idea of how it works, but you can download the code from his github repository for a closer look.

0 comments voice your opinion now!
composite rowset zendframework zenddbtable manytomany database


Rob Allen's Blog:
Metadata from Zend_Db_Table_Abstract
June 01, 2009 @ 07:53:14

As a part of his WinPHP Challenge project Rob Allen has come up with a method to combing the Zend_Db_Table component of the Zend Framework with the SuccessSQL tool to extract the table information directly from the database.

Zend_Db_Table provides all this information directly which is quite useful, however the intended use-case for Zend_Db_Table is that you extend Zend_Db_Table_Abstract for each table that you want to interact with. Obviously, SuccesSQL doesn't know in advance the names of the tables, so I created a stub class that allowed me to instantiate a Zend_Db_Table dynamically.

A few code snippets later and he has a working example showing a var_dump of the object's output - complete with full data for the two columns - ID and artist.

0 comments voice your opinion now!
tutorial zenddbtable successql zendframework


Developer Tutorials:
Zend Framework Tutorial
August 14, 2008 @ 07:52:16

On the Developer Tutorials site there's a new tutorial providing an introduction to the popular PHP framework, the Zend Framework.

I find myself constantly bombarded with questions from students and co-workers I've introduced to the Zend Framework regarding how the different components can come together to form a basic application. I've searched, I have found, I have emailed great tutorials, but still the most common questions are posed "What's should I include in index.php?", "Should I use Zend_Db_Table?", "And what about Zend_Form?"

It gives the usual overview of setting up an application and how its all structured but it also includes a specific look at the Zend_Form, Zend_Db_Table, Zend_Registry and Zend_Cache components.

0 comments voice your opinion now!
zendframework tutorial introduction zendform zenddbtable zendregistry zendcache


Ivan Iordanov's Blog:
extending Zend_Db_Table to create NestedSet models
July 16, 2008 @ 11:17:19

Ivan Iordanov has posted a method he's come up with to extend the existing Zend_Db_Table functionality (of the Zend Framework) to create NestedSet models for your app.

Last days I've been trying to customize Zend's Framework. My goal is to create simpler models. Currently I'm making some db models that handle stuff around wide used designs. Such design is the Nested Set model. It is an adjacent list realized in SQL as a tree. You can find a good introduction to nested sets at mysql developer zone.

He steps through the creation of some example database tables, his class and controller to hook into the Zend Framework application and this full code for his interface class to make the NestedSet models easy.

1 comment voice your opinion now!
zenddbtable nestedset model zendframework tutorial



Community Events





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


series interview symfony laravel bugfix zendserver install language deployment library opinion update framework community podcast unittest release package api introduction

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