Jump to content
Larry Ullman's Book Forums

Cms Database Example "user" Problem


msruby64
 Share

Recommended Posts

Just bought the Yii book and am working my way through it. On page 79, it refers to the Yii User model and says:

 

"for now, rename models/User.php as models/Useroriginal.php so you can revisit that code later."

 

After doing that and using the Gii model and controller generators, I get the error below when I go to any page. I think that perhaps renaming the User.php file has a side effect. If I change the name from Useroriginal.php back to User.php, the error goes away.

 

PHP Warning – yii\base\ErrorException

include(M:\RCD\Clients - Active\yii2_basic_test\vendor\yiisoft\yii2/web/User.php): failed to open stream: No such file or directory

1. in M:\RCD\Clients - Active\yii2_basic_test\vendor\yiisoft\yii2\BaseYii.php at line 288
 
Line 279: } elseif (strpos($className, '\\') !== false) {
$classFile = static::getAlias('@' . str_replace('\\', '/', $className) . '.php', false);
if ($classFile === false || !is_file($classFile)) {
return;
}
} else {
return;
}

Line 288: include($classFile);

if (YII_DEBUG && !class_exists($className, false) && !interface_exists($className, false) && !trait_exists($className, false)) {
throw new UnknownClassException("Unable to find '$className' in file: $classFile. Namespace missing?");
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...