CategoryZend Framework

Zend Framework related information

Zend Framework 1.8+ Module/Library Autoloading

Given the problems I had for the 1st Zend Framework website I did, I figured the next time I started one from scratch I would document how to get the autoloading working, since almost nowhere has it documented correctly. I forgot then too, so 3rd time lucky… The following code assumes the following: You have no model, controller or view directories at the root of application/ because they...

Zend Framework, Zend_Db_Table ORDER BY sorting NULL as last instead of first

If you have a group of fields, some of which may be null (such as an address, in which the 1st line of the address may or may not be filled in) then you may want to sort them all so that if null appears in a field, it's sorted to the bottom of the list as opposed to the top (which is the default behaviour) $select = $table->select(); $rowset = $table->fetchAll($select...

Access the non-direct View Helper methods in Zend Framework

Something that was temporarily puzzling me so I thought I would post about it. As in most examples to access the direct() method of a View Helper, you simply call the class name on the View Object: $view->baseUrl(); But if you want to access any of the methods other than direct() you've got to get the Helper first, as unlike most Action Helpers they don't implement a fluent interface because...

Zend_Auth_Adapter_Ldap “Adapter options array not in array”

Whilst trying to setup LDAP authentication for the first time in Zend Framework, I can across this little quirk when passing parameters to Zend_Auth_Adapter_Ldap, namely that I wasn't passing an array even though it was an array (which I checked using Zend_Debug) Basically Zend Framework expects you to have multiple LDAP servers (even if you have alternative failover in place on a single...

Get column names from a Zend_Db_Table object

If you need to get access to the column names of a Zend_Db_Table object (filtering a list of column names so that you discard any that don't match up, for example) then as found on StackOverflow you can do the following:
$table->info(Zend_Db_Table_Abstract::COLS);
Which of course works from within the object itself, so you could write a method such as: