title: How to delete specific models in Yii2?
body: <p>I need to delete all the records from A and its related models except some model/s.</p>
  
  <p>For e.g.</p>
  
  <p>A is a parent model :</p>
  
  <p>There are some related models with relation for e.g.</p>
  
  <p>B -> hasOne</p>
  
  <p>C -> hasMany</p>
  
  <p>D -> hasOne</p>
  
  <p>What if I want to remove A along with B and C but not D.</p>
  
  <pre><code>A::deleteAll("some condition");
  </code></pre>
  
  <p>So the above line should delete A, B, and C but not D.</p>
  
  <p>I saw documentation of Yii2, but it is not that good.</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>Thanks in advance.</p>