PHP warning

Attempt to read property "id" on null

C:\www\special\mbr.mrtruman.ru\protected\controllers\SiteController.php(198)

186         if(empty($model)) $this->redirect('/');
187         Yii::import('application.modules.Car.models.Cars');
188         Yii::import('application.modules.Models.models.Models');
189 
190         $model=Models::model()->cache(Yii::app()->params['CT'])->with('cars:ON')->findByAttributes(
191             [
192                 'slug'=>$model
193             ]
194         );
195         $car=Cars::model()->cache(Yii::app()->params['CT'])->ON()->findByAttributes(
196             [
197                 'order_number'=>$car,
198                 'model_id'=>$model->id,
199             ]
200         );
201         if(isset($car->id))$car->SetViewedCarsCookies($car->id);
202         
203 
204         if(empty($car)) $this->redirect('/');
205         if(empty($model)) $this->redirect('/');
206         $this->render(
207             'frontend/car',
208             [
209                 'car'=>$car,
210                 'model'=>$model,

Stack Trace

#7
+
 C:\www\special\mbr.mrtruman.ru\public\index.php(10): CApplication->run()
05 
06 // remove the following line when in production mode
07  defined('YII_DEBUG') or define('YII_DEBUG',true);
08 
09 require_once($yii);
10 Yii::createWebApplication($config)->run();
2024-03-29 02:51:25 nginx/1.25.3 Yii Framework/1.1.15