Pragmatism in the real world

Inserting binary data into SQL Server with ZF1 & PHP 7

If you want to insert binary data into SQL Server in Zend Framework 1 then you probably used the trick of setting an array as the parameter's value with the info required by the sqlsrv driver as noted in Some notes on SQL Server blobs with sqlsrv. Essentially you do this; $data['filename'] = 'test.gif'; $data["file_contents"] = array( $binaryData, SQLSRV_PARAM_IN, SQLSRV_PHPTYPE_STREAM(SQLSRV_ENC_BINARY), SQLSRV_SQLTYPE_VARBINARY('max') ); $db->insert($data); Where $db is an instance of Zend_Db_Adapter_Sqlsrv. If you use SQL Server… continue reading.

Zend Framework 1 is not dead; ensure you upgrade!

I'm delighted to announce that Zend Framework 1.12.1 has been released! This release fixes 50 issues which is a great result. I'd like to thank everyone who submitted a patch to ZF1 and to Matthew Weier O'Phinney, Frank Brückner and Mike Willibanks in particular for their work on this release. There's a few important things to note: There's a security fix in 1.12.1. Please read ZF2012-05 if you use Zend_Feed_Rss or Zend_Feed_Atom. The minimum PHP… continue reading.

ZF1.12 is released

I'm extremely happy to note that Zend Framework 1.12 has been released and is available here. The key changes are: ZF2's StandardAutoloader and ClassMapAutoloader have been back ported to `Zend_Loader`. ZF2's EventManager has been back ported to `Zend_EventManager` New `Zend_Http_UserAgent_Features_Adapter_Browscap` component New `Zend_Mobile_Push` component, contributed by Mike Willibanks New `Zend_Gdata_Analytics` component, contributed by Daniel hartmann `Zend_Http_UserAgent_Features_Adapter_Wurfl` has been removed due to WURFL licensing changes Many many bug fixes! See the changelog Getting ZF1.12 out of… continue reading.

Vagrant in Zend Framework 1

I recently added support for vagrant to the Zend Framework codebase to enable easier testing. I was motivated by some work the joind.in folks have done to get a working development environment for joind.in development using Vagrant. Vagrant is a fantastic tool that enables you to manage and run virtual machines from the command line, including automatic provisioning of them using puppet or chef. The really cool thing about it however from my point of… continue reading.

Unit testing Zend Framework 1

As part of our release process for Zend Framework 1.12, I've been working through the unit tests and running them on PHP 5.2.4 as it seems that recent changes weren't being tested with that version. This isn't totally surprising as Open Source contributors are, almost by definition, interested in new things and so are much more likely to be running PHP 5.4 rather than 5.2! This is, of course, a compelling reason for using continuous… continue reading.

One-to-many joins with Zend_Db_Table_Select

Let's say that you want to set up a one-to-many relationship between two tables: Artists and Albums because you've refactored my ZF1 tutorial. Let's assume that an artist has many albums. These are the basic table definitions: artists table: id, artist albums table: id, artist_id, title When you list the albums, you obviously want to see the artist name rather than the id, so clearly you use a join! Assuming you're using Zend_Db_Table, the easiest… continue reading.

Bradley Holt: The Case For Rapid Release Cycles

Bradley Holt has posted an interesting article on why rapid release cycles are a good idea for Zend Framework major versions. For a framework (and maybe for other software), I think the following rules are necessary in order for a rapid release cycle to work: Minimize backwards compatibility changes between major releases. Targeted and strategic refactoring, rather than major overhauls, are preferable if you are releasing often. Small backwards compatibility changes makes migrating from one… continue reading.

Robert Basic: Grouping Zend Framework controllers in subdirectories

A few months ago, Robert Basic wrote about this handy organisational tip: Thanks to a discussion on the Zend Framework mailing list I learned about a new feature, a feature that allows for grouping action controllers in subdirectories! He then goes on to explain how he can now group controllers related to admin within a subdirectory of controllers which makes organisation easier: Best part is that this feature requires no additional configuration. Create a subdirectory… continue reading.

Zend_Config_Ini and a string

One thing that is different between Zend_Config_Xml and Zend_Config_Ini is that with Zend_Config_Xml you can pass in an XML string as the first parameter of the constructor and it will work. This doesn't work with Zend_Config_Ini as we use parse_ini_file() under the hood. With PHP 5.3 however there is is a new function called parse_ini_string() which will allow us to load arbitrary ini string into Zend_Config objects. This can't go into Zend Framework 1 though… continue reading.