Yii2 namespacing in adavnced template

Hello, I have installed the advanced tamplate and I have the follow question:

  1. I created my own base controller in common folder.

  2. I want to use my basecontroller in backend folder, so I used:

class SiteController extends \common\controllers\BaseController

But I got the Php fatal error:

Class ‘common\controllers\BaseController’ not found

Can you help me please? (Sorry my english is very poor)

common/Basecontroller.php




<?php 

namespace common\controllers; 

use Yii; 

use yii\web\Controller; 

use common\models\AccessHelpers; 

 

class BaseController extends Controller { 

 

    public function beforeAction($action)

    {

        if (!parent::beforeAction($action)) {

            return false;

        }




     

        $operacion = str_replace("/", "-", Yii::$app->controller->route);


        if (AccessHelpers::getAcceso($operacion)) {            

            return true;

        }else{

            echo $this->render('@common/views/autenticacion/nopermitido');

            return false;

        }


        return true;

    }

}



backend/SiteController.php




<?php

namespace backend\controllers;


use Yii;

//use common\controllers\Basecontroller; 

use yii\filters\AccessControl;

use yii\filters\VerbFilter;

use common\models\LoginForm;


use yii\web\Controller;


/**

 * Site controller

 */

class SiteController extends \common\controllers\BaseController 

{

    /**



Hi,

Change your filename from:

Basecontroller to

BaseController

with uppercase C. ;)

And then try again. ;)

Best Regards

:rolleyes: :rolleyes: :rolleyes:

LOL

Wow, It work for me. I passed about 3 hours trying solve it issue.

Thank you very much