Search code examples
yii2yii2-advanced-appyii2-model

Yii2 class not found when moving application to live server


My application works perfectly locally however upon uploading to live server there's a couple of issues.

The first one is I get the following error on one specific page of my application but not on other that user the same class.

Class 'yii\helpers\url' not found

The above error is found even though I have the below line at the top of my view file.

use yii\helpers\url;

The other issue I get is when trying to locate a record within my Seo table using my Seo model however this error again only occurs on one part of my application but not the other part that uses the same table/model. Below is the error I get:

Class 'common\models\seo' not found

When I use the following line (I can confirm table relations work and the necessary data is their)

$seo = Seo::find()->where(['id' => $model->seo_id])->one();

Solution

  • use yii\helpers\url;

    change to

    use yii\helpers\Url;

    The same way seo class name will be started using capital case

    Seo