title: Yii2 Delete Query Using Relations
body: <p>I have defined a relation in Yii2 in which every website can have multiple feeds:</p>
  
  <pre><code>public function getFeeds() {
      return $this-&gt;hasMany(Feed::className(), ['website_id' =&gt; 'id']);
  }
  </code></pre>
  
  <p>Now consider following query:</p>
  
  <pre><code>$ids = [2, 3];
  $feeds = Website::find()-&gt;where(['user_id' =&gt; 1])-&gt;with(['feeds' =&gt; function($query) use ($ids) {
      $query-&gt;where(['id' =&gt; $ids);
  }])-&gt;all();
  </code></pre>
  
  <p>The corresponding raw SQL queries are:</p>
  
  <pre><code>SELECT * FROM `website` WHERE `user_id`= 1 // returns 4, 5, 6
  SELECT * FROM `feed` WHERE (`id` IN (2, 3)) AND (`website_id` IN (4, 5, 6))
  </code></pre>
  
  <p>My questions is, can I have delete version of this query using Active Record? Something like this:</p>
  
  <pre><code>SELECT * FROM `website` WHERE `user_id`= 1
  DELETE FROM `feed` WHERE (`id` IN (2, 3)) AND (`website_id` IN (4, 5, 6))
  </code></pre>
  
  <p>Any help would be appreciated.</p>