Upgrading from Zend Framework 1.7 to 1.9 – The autoloader

Today I upgraded a project we started working on last year from Zend Framework 1.7 to Zend Framework 1.9. I excepted to run into several API incompatibilities, but the only problem I got was the autoloader.

In Zend 1.7, and earlier versions, the autoloader was registered like this:

  2. require_once "Zend/Loader.php";
  3. Zend_Loader::registerAutoload();

In Zend Framwork 1.9 this has changed slightly, you now have to register the namespaces you want to autoload:

  2. require_once ‘Zend/Loader/Autoloader.php’;
  3. $loader = Zend_Loader_Autoloader::getInstance();
  4. $loader->registerNamespace(‘Dqc_’);

This was the only change we needed to do to upgrade from 1.7 to 1.9, quite impressive!

Submit comment

Allowed HTML tags: <a href="http://google.com">google</a> <strong>bold</strong> <em>emphasized</em> <code>code</code> <blockquote>