Delete() Issue

Okay so I have every part of this method working properly except what is in the foreach loop. I can’t figure out why “$found->delete();” is not deleting all the Tasks I’m asking it to. “$model->delete();” works perfectly fine deleting my Project Model.

What am I missing here?


public function actionDeleteLead($id)


            $model = $this->loadProjectModel($id);

            $tasklistID = $model->tasklist;

            $search = JTaskTasklist::model()->findAll('tasklist_id=:tasklist_id', array(':tasklist_id'=>$tasklistID));


            foreach($search as $joint)


                //Deletes all tasks

                $found = Task::model()->findByPk($joint->task_id);




	//Deletes all joints



            //Deletes tasklist

            $tasklist = Tasklist::model()->findByPk($tasklistID);



             //Deletes Builder/Project joint



            //Deletes project


	// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser


		$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));