skip to Main Content

use alias in joinWith yii2 – PHP

I'm trying to connect a relation table, and and get the max value $query->joinWith('hotelPrices') ->andWhere([HotelPrice::tableName() . '.price' => $form->prices]) ->max(HotelPrice::tableName() . '.price'); but i get this error SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'hotel_price' how to…

VIEW QUESTION

Yii2 Trying to get property of non-object – PHP

I'm trying to get data from a model. $profile = Profile::findOne(['user_id'=>$appointment->user_id]); $diabetes = $profile->diabetes; I get an error Trying to get property 'diabetes' of non-object. Tried to check the availability of data through: $profile->getAttributes(['diabetes']) Data present! But I can't use…

VIEW QUESTION

YII2 sef urls construction – PHP

I have catalogue with products. Urls for products looks like this domain.com/adv?id=14792. I want to beautify urls like this domain.com/adv/14792. In web.php I tried to like this 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, 'enableStrictParsing' => true, 'rules'…

VIEW QUESTION
Back To Top
Search