So I have 2 classes, let's call them AuthOne and AuthTwo, and depending on the incoming request, I want to be able to init either one on the fly. So in my auth.php, I check the request (edited for brevity):
use Sandbox\Auth\AuthOne; use Sandbox\Auth\AuthTwo; $auth = 'Auth' . ucfirst($this->request->getPost('auth')); $oAuth = new $auth();
but this doesn't work, I get an error
PHP Fatal error: Class 'AuthOne' not found in .... /sandbox/app/library/auth/auth.php ....
however, if I simply just do:
$oAuth = new AuthOne();
$oAuth = new AuthTwo();
this works fine! And I've checked to make sure that $auth does indeed equals AuthOne or AuthTwo and as you can also see in the error message. What am I doing wrong?