On 14/03/13 09:52, Brad Waite wrote:
Thanks, David. Your examples were clarifying.
I think I was expecting the automapper to create namespace maps for the classes
under PHPExcel. It looks like composer
might do that if asked, but I haven't tried yet.
You just use it like you would any old non-namespaced code.
As long as I prefix the class with \ or explicitly "use" the class.
Oh, you're right. I'd missed that part. That does feel wrong...
especially since functions and constants don't exhibit the same
behaviour, but that's probably because they can't be autoloaded yet.
So that said, you can still use the "use" statement to "import" the
PHPExcel_IOFactory into your current scope:
namespace MyApp;
use \PHPExcel_IOFactory as ExcelFactory; <- alias is created
new ExcelFactory (); // \PHPExcel_IOFactory <- autoloading happens here
This works, too, although the "use" is of dubious value:
namespace MyApp;
use \PHPExcel_IOFactory;
new PHPExcel_IOFactory(); // \PHPExcel_IOFactory
-Brad
It's useful for documenting your dependencies and for shortening really
long class names, but yeah, mostly superfluous.
David
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]