Extending a class with an other namespace with the same ClassName

Viewed 33860

I'm trying to use namespaces. I want to extend a class inside a different namespace. The name of the class is the same. Example:

Parent:

namespace Base;

class Section extends Skeleton {

protected $id;

protected $title;

protected $stylesheet;
}

Child:

namespace Base2;
use \Base\Section;

class Section 
    extends \Base\Section {

}

It is an application which uses Doctrine 2 and Zend Framework. The Skeleton class used by Base/Section is just an abstract class that contains the magic methods (__get, _set, etc).

When I try to instantiate a \Base2\Section class it throws an error:

Fatal error: Cannot declare class Base2\Section because the name is 
already in use in /var/www/test/application/Models/Base2/Section.php 
on line 7

Any idea's?

2 Answers
Related