1
votes

i have been using a modular structure for my zend framework application.

This is my sample project hierarchy:

  • application

    • modules

      • v1
        • controllers
          • SampleController.php
        • models
        • views
        • configs
          • module.ini
    • configs

      • application.xml
  • library
    • My
      • Math
        • File.php

I want to access the library class file: "File.php" inside my module controller: "SampleController.php".

I tried instantiating it from my controller like this:

$sample = new My_Math_File();

But i got an error like this:

Fatal error: Class 'My_Math_File' not found in E:\zend\Apache2\htdocs\project\application\modules\v1\controllers\SampleController.php

Could not undserstand how to access the library resources from my module controller.

1

1 Answers

3
votes

make sure to add autoloaderNamespaces[] = "My" to your application.ini and 99% this would solve it