Example #1
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         $dataImage = ClassifiedImage::find()->where(['classified_id' => $this->id])->all();
         //            foreach($dataImage as $img){
         //                unlink($img['image']);
         //            }
         ClassifiedImage::deleteAll('classified_id = ' . $this->id);
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 public function beforeDelete()
 {
     if (parent::beforeDelete()) {
         if ($this->type == 0) {
             ClassifiedGuest::deleteAll('id = ' . $this->user_id);
         }
         Classified::deleteAll('id = ' . $this->classified_id);
         ClassifiedImage::deleteAll('classified_id = ' . $this->classified_id);
         return true;
     } else {
         return false;
     }
 }
Example #3
0
 protected function findModelImage($id)
 {
     if (($model = ClassifiedImage::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }