I appeal to the controller action and try to call the model class method from it. At the same time, the error "Class 'app \ controllers \ SheduleTrip' not found" pops up. After all, I have prescribed "use app \ models \ ScheduleTrip;". That is, the class must be in models, not controllers. But he does not see him. Here is what is written in the controller code:

namespace app \ controllers;

use Yii;

use app \ models \ Order;

use app \ models \ OrderSearch;

use yii \ web \ Controller;

use yii \ web \ ForbiddenHttpException;

use yii \ web \ NotFoundHttpException;

use yii \ filters \ VerbFilter;

use app \ components \ Helper;

use app \ models \ Trip;

use app \ models \ Direction;

use app \ models \ ScheduleTrip;

...

public function actionSetTrips ($ shedule_id = 1) {

var_dump(SheduleTrip::getSheduleTripListByShedule($shedule_id)); return 123; 

}

    1 answer 1

    The method contains a class with an error of one character c

    It should not be SheduleTrip but S with heduleTrip, if the use is correct.

    And since this class is not in use , php tries to find it in the directory of the current class.

    I recommend working in a development environment, for example PhpStorm, she would prompt you all at once.