Model Classes can not be found

Hi, I use Multiple Module File Structure ( this link )

namespace Phsocial\Frontend\Controllers;

class IndexController extends \Phalcon\Mvc\Controller
{

    public function testAction()
    {
        $user = new Users;
    }
}

In My Controller in frontend, I am trying to call a Model, But this error happens: Fatal error: Class 'Multiple\Frontend\Controllers\Users' not found in ...

as you see it searchs inside Controllers to find Users but it is my Model. I haven't changed any configuration. any help. thanks

You need to set up the autoloader to look in the correct directory for your Models. The tutorials show you how to do this.

hi I also encountered this problem, you solve it??

I was the same error !

I too am having this issue, and unless I'm missing something, I believe I already have the Models namespace defined to the correct directory, as suggested by Dylan (See Below).

    $loader->registerNamespaces(array(
        'FuseCMS\Frontend\Controllers' => __DIR__ . '/controllers/',
        'FuseCMS\Frontend\Models' => __DIR__ . '/models/',
    ));

I have a Pages.php Model Class in the models folder, but when I try to define a variable in the Page Controller to new Pages(); I get the following error.

$Pages = new Pages(); // Invoke the Model

Fatal error: Class 'FuseCMS\Frontend\Controllers\Pages' not found in D:\web-development\fuse-cms\apps\frontend\controllers\PageController.php

It appears that it's trying to load the model as a controller. So I'm at a bit of a loss.

edited Dec '16

If you havent solved this, This is how you go about it.

In you User Model, let the first line be the namespace. In this case

namespace Phsocial\Frontend\Models;

In your controller, reference the User model class as follows;

$user = new \Phsocial\Frontend\Models\Users();