I understand the namespace to avoid collisions between different libraries, 
but I didn't understand your second point about extending classes. With or
without namespaces I may extend a class to get a more specific behavior.

I have an error updating it to 1.8 because of the new namespaces added :-( 

Warning: include(My\Constants.php) [function.include]: failed to open
stream: No such file or directory in
C:\Data\websites\cms\library\Zend\Loader.php on line 83

$autoloader = Zend_Loader_Autoloader::getInstance(); 
$autoloader->registerNamespace(array('My_', 'MyZend_'));

I have a class My_Constants and it's path is
application/constants/Constants.php
In the include path I added  './application/constants/'





Matthew Weier O'Phinney-3 wrote:
> 
> -- debussy007 <[email protected]> wrote
> (on Sunday, 12 July 2009, 02:09 AM -0700):
>> I updated the library for one of my projects to 1.8 and I need some
>> advice
>> on renaming my classes with namespaces ...
>> 
>> Should I prefix all my classes (which are not part of a specific library)
>> by
>> the same namespace ? e.g. My_...
>> 
>> My_Constants
>> My_Model_DbTable_Articles
>> My_Plugin_LanguageHandler
>> and so on ?
> 
> Typically, yes. :) It's a recommendation of the PHP project itself, as
> well as PEAR and ZF. It helps with avoiding naming collisions, and also
> allows you to extend classes locally to provide alternate behavior.
> 
> -- 
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Namespace-help-tp24446973p24449740.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to