skip to Main Content

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

How to ignore where clause if condition is empty in Yii2 – Mysql

I know this same question is already asked before. But I have tried the solution but it's not working for me. $comp_ids = AllowArea::find() ->select(['comp_code']) ->where(['user_id' => Yii::$app->user->id]) ->column(); $ref = (new yiidbQuery()) ->select([ 'ProductCode', 'ProductNameFull', 'ProductSpec', 'ProductGroup', 'CompanyCode', 'CompanyName'…

VIEW QUESTION
Back To Top
Search