yii2: Update values in two tables using single controller action?
<p>I have two tables table1 and table2 and I am trying to update row in these two table.I have same values on both table but id is different so i tried like this, 
my controller,</p>

<pre><code>public function actionUpdate($id)
  {
   $model = $this-&gt;findModel($id);
   if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-     &gt;validate()) {
         Employee::find()-&gt;where(['Id' =&gt; $id])-&gt;one()-&gt;update();
         User::find()-&gt;where(['User_id' =&gt;$id])-&gt;one()-&gt;update();
         if ( $model-&gt;save()) { 
        return $this-&gt;redirect(['index']);
         }
    } else {
        return $this-&gt;render('update', [
            'model' =&gt; $model,]);
    }
}
</code></pre>

<p>I have table like this</p>

<p>CREATE TABLE <code>Employee</code> ( <code>Id</code> int(11) NOT NULL,<code>Company_company_id</code> int(100) NOT NULL,<code>Company_name</code> varchar(100) NOT NULL, <code>Employee_id</code> int(100) NOT NULL, <code>Name</code> varchar(100) NOT NULL,<code>Email_id</code> varchar(100) NOT NULL,<code>Password</code> varchar(16) NOT NULL,<code>Joining_date</code> date NOT NULL,<code>Confirmation_date</code> date NOT NULL, <code>Relieving_date</code> date NOT NULL,<code>Leaves_Available</code> int(25) NOTNULL,<code>Status</code>enum('Active','Inactive') NOT NULL,) </p>

<p>CREATE TABLE <code>User</code> (<code>Id</code> int(15) NOT NULL,
<code>Name</code> varchar(100) NOT NULL,<code>Email_id</code> varchar(100) NOT NULL,<code>Password</code> varchar(16) NOT NULL,<code>Status</code> enum('Active','Inactive') NOT NULL,) </p>

<p>I tried like this but i can't update both table<br>
pls anyone help me
Thanks in advance</p>