Entries in the ' zend framework ' category

Written April 19, 2008 in webdev, zend framework

I’ve been doing a lot of work with Zend Framework the past few days. One of the things that’s been bugging me is how much code I have in my controllers to save data. The validation and filtering is handled by the Zend_Form object, but the forms don’t always match the models as far as fieldnames and other information, so I don’t just want to throw a form result set at a Zend_Db_Table_Row and let it figure things out.

Result: I taught my forms to know how to fill and save themselves. They use the model layer to accomplish this, but work mostly by extending the normal Zend_Form with a ‘populate’ and a ’save’ method. The populate method can be static. It takes a primary key and returns an array that can be used to populate the form. The save method is not static, and depends on the form already being populated and having been validated.

As a quick disclaimer, I by no means would say that this is the best practice for this kind of thing … and this code is quickly hacked up edited code that I put together from what I’m really doing. No guarantees that it works … however, the theory works for me!

Continue Reading »

Written March 31, 2008 in webdev, zend framework

Great little tutorial on getting started with Zend Framework and the Doctrine ORM. It only provides simple usage, but it’s a good place to start. Doctrine is an Object Relational Model library for PHP >=5.2 that supports all kinds of nifty features like Migrations.

Continue Reading »

Written March 30, 2008 in zend framework

Let’s say you’re scanning a website for it’s feeds using Zend_Feed::findFeeds($URL). The function looks at a website, and checks for the link tags in the head part of the document that would indicate that it has feeds. Then it returns an array of those feeds.

Now, for the sake of …

Continue Reading »

Written March 22, 2008 in apple, php, symfony, webdev, zend framework

If you use vim and develop in PHP, you need these tips.

If you’re on a Mac like I am but prefer command-line vim in a terminal window, you can download an updated version of VIM and then just symlink /usr/bin/vim to the bundle in the /Applications directory, and it’ll run …

Continue Reading »

Written November 29, 2007 in php, symfony, webdev, zend framework

The Symfony and Zend frameworks are so amazingly different that they almost don’t deserve to share the title “framework.”

Like the .Net Framework, Zend is a bucket of functions that, together, provide advanced interfaces to the most complex of tasks that web developers need to write regularly. They then leave the developer to work up a quick interface to the application, which they enable with their views structure. Zend’s major strength and weakness is that there isn’t one particular way to do things and that you can pick and choose which libraries you want to use.

Both frameworks are PHP5-native frameworks and won’t function in PHP4. Both are heavily object-oriented and make use of inheritance that’s only offered in PHP>5. Both use the front controller model.

The similarities end there.

Zend uses very little code generation and configuration is all in the front controller; Symfony has a great deal of code generation and a huge amount of configuration overhead. Zend is flexible about it’s directory hierarchy and allows you to heavily customize your directories to use global code libraries; Symfony has a required directory structure that is created when you use the command line tool to create modules. Zend doesn’t require command-line creation of modules.

After the jump, I’ll focus on a few areas where there’s some specific differences.

Continue Reading »