2

I encountered a strange issue today with Yii2.

I am using yii2-user extension and i have overridden the RegistrationController in my app folder to add few more features.

The thing is its working fine in my XAMPP but not in the server (Cent OS).

Im getting the below error.

**ReflectionException

Class app\controllers\user\RegistrationController does not exist**

My config is...

    'modules' => [
    'user' => [
            'class' => 'dektrium\user\Module',
            'layout'=>'@app/views/layouts/main.php',
            'mailer' => [
                'viewPath' => '@app/views/mail',
            ],
            'modelMap' => [
                'User' => 'app\models\User',
                'RegistrationForm' => 'app\models\RegistrationForm',
                'Profile' => 'app\models\Profile',
            ],
            'controllerMap' => [
                'registration' => 'app\controllers\user\RegistrationController',
                'security' => [ 'class' => 'dektrium\user\controllers\SecurityController', 'layout' => '@app/views/layouts/login', ],
            ],
    ],
],

My new controller file is...

namespace app\controllers\user;
use Yii;
use app\models\RegistrationForm;
use dektrium\user\controllers\RegistrationController as BaseRegistrationController;
use yii\filters\AccessControl;

class RegistrationController extends BaseRegistrationController
{
.......
}

Can anyone please let me know what im doing wrong?

Thanks in advance!

SP-TY
  • 973
  • 1
  • 7
  • 13

1 Answers1

1

The app\controller..... filname don't exist or don't match cause lower/uppercase difference between OS the problem is related to the fact unix is case sensitive and windows not .. check for you class/filename if you have a lowercase (typically ath the begin of camel case)

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • what is the name of your directory project ? and have replied the same structure in you controller ? – ScaisEdge Jul 13 '16 at 16:45
  • **csot** is the directory name of the project... I tried it but not working – SP-TY Jul 13 '16 at 16:48
  • have you replied the same directory structure for RegistrationController? – ScaisEdge Jul 13 '16 at 16:51
  • Actually, the config i have now is working fine in my local environment but it throws error only in the server which is running on Cent OS.. So, i assumed it might be related to any case sensitive issue. – SP-TY Jul 13 '16 at 16:52
  • Yes I replaced the "app" with "csot" in my controller namespace as well.. – SP-TY Jul 13 '16 at 16:53
  • Its windows - XAMPP – SP-TY Jul 13 '16 at 16:53
  • Then the problem is related to the fact unix is case sensitive and windows not .. check for you class/filename if you have a lowercase (typically ath the begin of camel case) .. i have update the answer .. with this indication .. usea app instead od project name if this work locally .. – ScaisEdge Jul 13 '16 at 16:57
  • Yes! You are correct.. I used the filename as Registrationcontroller instead of RegistrationController. Thanks for your help! – SP-TY Jul 13 '16 at 17:02