I am loading a custom class from the lib folder and I'm getting the following error:
Fatal error: Class 'NameSpace_MyClass' not found in /dir/to/site/app/code/local/NameSpace/Module/controllers/Adminhtml/ModuleController.php on line 93
My class directory tree looks like this
./lib
/NameSpace
/MyClass.php
/Varian
/Zend
The declaration in the controller looks like:
$class = new NameSpace_MyClass($id);
And MyClass.php
looks like this
class MyClass{
private $id;
public function __construct($id) {
$this->id = $id;
}
}
How am I able to call this class? I'm under the impression I don't need to do anything in an xml file to load this as Magento/Zend auto includes files in the lib
folder. Is this correct?
_constructor
of MyController behind aif(!class_exists('NameSpace_MyClass'))
and it throws up this errorFatal error: Cannot redeclare class MyClass
in the class file where it declares the class name