Class not found

Hello there.

I hope somebody to help me fixing this issue. I am using expressions to validate access in some controllers, until yesterday all worked fine, but yesterday I uploaded some changes and when I tried to access to admin panel of my website I got this error.

Fatal error: Class ‘User’ not found in /var/www/vhosts/ : eval()'d code on line 1

In the accessRules function of the Controllers, I putted something like this:





I don’t know what the error is, but I know that before yesterday’s changes, all worked fine, and I didn’t change those expressions.

The error must be in User::ADMIN_LEVEL constant, this one is instanced in a model, but I already had that model imported in config/main.php

Can someone please help me with this?

By the way, I have the same site in localhost (using WAMP) and there is all fine.


Be sure to import "User" model class must be before you try to access it

Consider using a version system, like Mercurial. It’s really easy to create a repository (hg init) and then you will be able to watch the history, provided that you commit after each change.

In that case, maybe a diff between hosts will help?

Maybe it’s case sensitivity issues?

Gustavo thanks for the reply. But I already had imported User class in the main.php. (‘application.modules.users.models.*’). I also tried by changing users for Users and still nothing.

I know that the problem is in the import, but I haven’t changed that import from the main, so I don’t know what happened there.

Jacmoe, could you post a link of Mercurial, I’m interested.

Thank you guys

Fixed. Don’t ask lol. I’ve just uploaded the users module again and it worked.



It works on Linux too, by means of the ‘thg’ command set - running ‘thg commit’ instead of ‘hg commit’.

Mercurial itself:

Mercurial comes bundled with the TortoiseHg install, but you might want to check it out.

One of the first things you want to do after creating your repository and making the first commit, is to ignore the assets and the protected/runtime directories.

In the commit dialog, right-click any of the offending directory entries, and choose ‘ignore’, then remove the filename bit from the path and add a star, then ‘Add’.

It should leave you with a .hgignore which looks like this:

syntax: glob