msruby64 Posted September 17, 2015 Share Posted September 17, 2015 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 More sharing options...
Larry Posted September 17, 2015 Share Posted September 17, 2015 You shouldn't be able to change User-original.php back to User.php because the Gii steps should have created a new User.php. I'd confirm one exists (the new one should extend ActiveRecord). Link to comment Share on other sites More sharing options...
Recommended Posts