public static function deleteWish($postid)
 {
     $data = Posts::find()->where(['and', 'UserID' => \Yii::$app->user->getId(), 'PostID' => $postid])->one();
     if (isset($data->PostID)) {
         Posts::deleteAll(['PostID' => $postid]);
         PostURL::deleteAll(['PostID' => $postid]);
         // След строчки уже были в коде, можно вынести их
         $imgstodelete = PostImgs::find()->select(['PostImgID', 'PostImg'])->where(['PostID' => $postid])->all();
         if (count($imgstodelete)) {
             foreach ($imgstodelete as $img) {
                 if (isset($img->PostImgID)) {
                     unlink(Yii::getAlias('@webroot/photos/wishlist/' . \Yii::$app->user->getId() . '/' . $img->PostImgID . '-xn.jpg'));
                     unlink(Yii::getAlias('@webroot/photos/wishlist/' . \Yii::$app->user->getId() . '/' . $img->PostImgID . '-n.jpg'));
                     unlink(Yii::getAlias('@webroot/photos/wishlist/' . \Yii::$app->user->getId() . '/' . $img->PostImgID . '-s.jpg'));
                 }
             }
         }
         PostImgs::deleteAll(['PostID' => $postid]);
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPostImgs()
 {
     return $this->hasMany(PostImgs::className(), ['PostID' => 'PostID']);
 }