0

I would like to load a Class that I have located in src/Bandit/EpsilonGreedy. EpsilonGreedy itself extends an abstract class located in the same Folder src/Bandit/ABandit.

When I try to load the class with new App\Bandit\EpsilonGreedy(); I nor get an error message nor an instance of the class.

The namespace on top of both PHP-Files i have choosen is namespace App\Bandit;.

Do I have to bypass the autoloader of CakePHP to instantiate such classes in own Folders beside Controller, Model and View?

Thanks!

Niklas
  • 95
  • 1
  • 9
  • No error message, an no instance of that class? I would doubt that unless you disabled error reporting as well as error logging, or something goes so horribly bad that PHP won't even run your code. How have you tested that there are no errors? Have you checked the logs? Have you made sure that your error display/logging is configured properly? What is it that you get, what does `new` return? – ndm Apr 12 '16 at 15:25
  • It seems like CakePHP can't find the abstract class `ABandit`: `class EpsilonGreedy extends \App\Bandit\ABandit { ... }`. When I try the following: `class EpsilonGreedy extends ABandit { ... }`, CakePHP does not find the class, but throws at least an exception with the message that the class could not be found. – Niklas Apr 13 '16 at 07:07
  • Solved: I found the error in the Apache Logs. It was an visibility error of an attribute of the abstract class. – Niklas Apr 13 '16 at 07:55
  • @Niklas just wanted to say that the issue you were having is a general PHP issue. This might help you in the future if you have anymore questions. – Marlinc Apr 14 '16 at 23:22

0 Answers0