Model Manger not finding model by class names

I'm having a problem with class loading when using the Model Manager. I'll try to give you all the relevant info:

-- AutoLoader: I'm using the namespace strategy. $loader->registerNamespaces( array( 'App\Controllers' => $config->application->controllersDir, 'App\Models' => $config->application->modelsDir, 'App\Forms' => $config->application->formsDir, 'App\Utils' => $config->application->utilsDir, 'App' => $config->application->libraryDir ))->register();

-- My Design model defines a hasOne relationship like so: $this->hasOne("design_file", "DesignFiles", "uuid");

-- I'm trying to access the design file in my controller like so: $design->getDesignFiles();

I get an error: in the load function of the manager. "DesignFiles" class is not found.

I did this hack to get it to work. Relationship definition: $this->hasOne("design_file", "App/Models/DesignFiles", "uuid");

Access in the controller: $design->__call("getApp\Models\DesignFiles");

It works but it's super awkward. Same happens in my PQL statement, I have to write the namespace there too. Does anybody know what I might be doing wrong from the Model Manager not to find my model classes by their names alone`?



4.4k

Have you try:

$this->hasOne("design_file", "App/Models/DesignFiles", "uuid", array("alias" => "DesignFiles"));