Insert query in yii2.0 framework -


i using yii 2.0 framework , can me write insert query in controller please, writing query this, proper query

$userid = \yii::$app->user->identity->id;     $restid = \app\models\restaurantbusiness::find()->select('restaurentid')->where(['userid' => $userid ])->one();      $restdetailid = $restid->restaurentid;     $restomenuid = restomenu::find()->insert('restaurantbusiness_restaurentid')->where(['restaurantbusiness_restaurentid' => $restdetailid])->one(); 

please me write correct insert query. in advance

ok assume no 1 knows :-/

i found solution

there no need write insert query @ all, in controller before saving wrote this

$model->restaurantbusiness_restaurentid= $restdetailid;

thats all.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -