Class not found

Permalink
Have found serveral oher topics concerning the same issue, but I am not able to solve my issue. Apparently something in 5.7.5 has changed that broke my package.


I have got the following two files:
/­packages/packagename/­controllers/­single_page/­sub_dir/­pagename.php
/­packages/packagename/models/modelname.php


In the controller:
namespace Concrete\Package\Packagename\Controller\SinglePage\SubDir;

use \Concrete\Package\Packagename\Models\Modelname as Mymodel;

class Pagename extends \Concrete\Core\Page\Controller\PageController {
public function my_function(){
$output = Mymodel::function();
}


In the model:
?php
namespace Concrete\Package\Packagename\Models;

defined('C5_EXECUTE') or die("Access Denied.");

use \Concrete\Core\Legacy\Model;
use Loader;

class Modelname extends Model{



But when running i get a class not found error:
Class 'Concrete\Package\Packagename\Models\Modelname' not found


What should I change to get this working?

 
hutman replied on at Permalink Reply
hutman
You need t move your models into a src folder in the root of your package and then update the filenames to be Camelcased and update the namespaces throughout the package to have them in that place. They stopped auto loading the models in 5.7.5
rklomp replied on at Permalink Reply
Thanks moving my files to a Src folder fixed it!