It is just a few weeks or month ago when Zend Framework 1.8.0 was released, followed by Zend Framework 1.8.1. However, I am very hesitant because I can’t make the command line tool zf.bat work for creating a new project.
I am amazed with the new update on Class Autoloading using the new Zend_Loader_Autoloader (depreciating the old Zend_Loader::registerAutoLoad()). But the problem is that I can’t make a new project using it’s tool.
So I decided to not use the zf.bat and directly use it on my existing project. I replaced the whole Zend directory with the new version. When I tested the main page, it says the my previous code:
Zend_Loader::registerAutoload()
is already depreciated. Therefore I need to use the new Zend_Loader_Autoloader. I am forced to read the documentation (my bad) and it got it finally. Here is the replacement for my autoloader.
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace(‘My_’);
The My_ there means the it adds to its namespace the My_ so that when there is a class named My_Gallery, it will use its auto loading magic. I have actually one namespace to add since I’m creating my own plugin.
Still it is not enough. We need to optimize it by removing all instances of require_once like what we’ve done on my old post on Zend Framework Optimization Tips. On my old post, we can remove all require_once except those inside the main entry index.php which will need to load first the Zend_Loader.
In Zend Framework 1.8.2, we need at least two require_once statement. By the way, after I removed all require_once from the steps above, my application didn’t work anymore. We need to add require once to:
Zend/Loader/Autoloader.php
the line which would includ the file Zend/Loader.php.
After all those frustrating steps, I’m now using the latest version. Oh, its at least more stable than using the 1.8.0 immediately. Thanks to the Zend Framework Team!
Here’s some more tips on upgrading.
http://digg.com/d1s82K