I'm creating an MVC application where there is dependency injection to instantiate the classes with connection to the database, the problem happens when I upload the application to a remote server, when I try to access I get the following error "Uncaught Error: Class '\ App \ Models \ Records' not found in ..."
The error itself is in the Container.php file
namespace SON\DI;
class Container
{
public static function getClass($name)
{
$str_class = "\App\Models\".ucfirst($name);
$class = new $str_class(\App\Init::getDb());
return $class;
}
}
It is called in the SubmissionController class
$registros = \SON\DI\Container::getClass("Registros");
Also follows the class Register.php analogous to all other Model classes that would use the Injection
namespace App\Models;
class Registros {
protected $db;
public function __construct (\PDO $db)
{
$this->db = $db;
}
The curious thing is that the code works in place but it is not working on the host, I've already reviewed forums but I did not get an answer.