Archive for March, 2010

Matthew Turland: Models in Zend Framework

Matthew Turland has written an article on models in Zend Framework.

A question that frequently comes up in my interactions with other developers about Zend Framework is how to approach designing models. There’s a small collection of resources and advice that I generally give on the subject, so I thought I’d write up a blog post to give people an easy place to access it all.

He then goes on to provide links to articles that cover Data Mappers, Table/Row Data Gateway and Active Record with Doctrine approaches to designing a model, before covering the approach he himself uses.

Posted by Rob on 27th March 2010 under Around the web | Comments Off

Chris Morell: Zend Framework Bash Completion Script

Chris Morell has created a bash completion script for Zend Framework.

If you use the Zend Framework CLI interface much you probably find yourself expecting tab-completion to work. Well, with this bash completion script it will.

Once installed, typing “zf cr” followed by a tab will automatically fill in “create” for you. Very handy.

Posted by Rob on 21st March 2010 under Around the web | Comments Off

Robert Gonzalez: Building the PHP MS SQL Server extension from source on Ubuntu 8.10

MSSQL on Linux seems like a bit of a black art at times. Today though, Robert Gonzalez has posted an article on how to build the SQL Server extension for PHP from source on Ubuntu which could make life easier:

the fact remained for me that I had to be able to integrate database communication from LAMP to a SQL Server on Windows [...] the only way to make this happen is to build the SQL Server extension from source.

He then goes on to detail the steps required, starting with building the FreeTDS library, building the PHP extension and configuring it all so that it works.

Posted by Rob on 16th March 2010 under Around the web | 2 Comments »

Juozas Kaziukenas: ZF is not bloated

Juozas Kaziukenas has posted a new article looking at why people seem to believe that Zend Framework is bloated. In Zend Framework is NOT bloated, he says:

Zend Framework is always considered as being the slow/bloated one. I don’t think this is right, so I decided to prove that it’s not correct and in fact ZF is as good as other frameworks are. This post doesn’t cover any benchmarks though; this is more like a architecture review and some misconceptions disproof.

He then goes on to discuss various areas that perceived to be bloated, such as the installation footprint, amount of features and system resource use, looking at why the perception exists and what the reality is.

Posted by Rob on 12th March 2010 under Around the web | Comments Off

Matthew Weier O’Phinney’s Blog Module Bootstraps in Zend Framework

Matthew Weier O’Phinney has posted a new article on bootstrapping modules:

When it comes to modules, we have three typical problems or requirements:
  • Ensuring that module resources — models, view helpers, etcc. — are available elsewhere in the application
  • Initializing module-specific resources, such as routes, navigation elements, etc.
  • Running code specific to this module (selecting a specific layout, selecting a specific database adapter, etc)
Zend_Application answers the first two questions. By default, it sets up a resource autoloader with targets for all the common resources (models, forms, view helpers and filters, DbTable objects, etc.), and also allows you to specify resources to load at bootstrap time.

He then goes on to explain what module bootstraps are used for and how to use front controller plugins to handle initialisation tasks if the module is the one being executed.

Posted by Rob on 11th March 2010 under Around the web | Comments Off

Steve Hollis’ Blog: Practical Nested Transactions with Zend_Db and MySQL

Steve Hollis has written an interesting article about how to handle nested transactions with Zend_Db and MySQL.

He starts by covering what transactions are and why they are useful for data integrity, showing how to use them with Zend_Db. He then goes on to talk about the problem of mapping a single transaction across many model objects:

Although transactions are a useful tool, sadly they don’t always fit well into an object oriented application. It’s common to delegate the actual persistence (inserting and updating) of models to a save method which, in turn, goes on to save child objects.
Without ugly hacks which tie the models directly to the database operations, it becomes difficult to establish which object started the transaction and when it should be committed.

In order to help solve these issues, Steve introduces an extended Mysqli adapter for Zend_Db that allows for nesting, along with some notes on its usage. Life Steve, I also heartily recommend using Zend_Db_Profiler for monitoring your database queries during development.

Go have a read!

Posted by Rob on 5th March 2010 under Around the web | 1 Comment »