Wywala Mi błąd 500 kiedy chce usunąć coś co występuje w innej tabeli:
public function actionDelete($id) {
if (Yii::app()->getRequest()->getIsPostRequest()) {
$relationA = IngredientsHasAdditions::model()->findAll('ingredients_idingredients=:ingredients_idingredients',array(':ingredients_idingredients'=>$id));
$relationS = IngredientsHasSpice::model()->findAll('ingredients_idingredients=:ingredients_idingredients',array(':ingredients_idingredients'=>$id));
$relationA->delete();
$relationS->delete();
$this->loadModel($id, 'Ingredients')->delete();
if (!Yii::app()->getRequest()->getIsAjaxRequest())
$this->redirect(array('admin'));
} else
throw new CHttpException(400, Yii::t('app', 'Your request is invalid.'));
}