Fix "Undefined variable: ex"

This commit is contained in:
Asturyan
2014-03-21 09:20:48 +01:00
parent fad37219a1
commit eaf5ab7a7e

View File

@@ -287,7 +287,6 @@ abstract class AbstractCrudController extends BaseAdminController
// Error (Default: false) // Error (Default: false)
$error_msg = false; $error_msg = false;
$ex = new \Exception();
// Create the Creation Form // Create the Creation Form
$creationForm = $this->getCreationForm($this->getRequest()); $creationForm = $this->getCreationForm($this->getRequest());
@@ -336,15 +335,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage(); $error_msg = $ex->getMessage();
} }
$this->setupFormErrorContext( if (false !=== $error_msg) {
$this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)), $this->setupFormErrorContext(
$error_msg, $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
$creationForm, $error_msg,
$ex $creationForm,
); $ex
);
// At this point, the form has error, and should be redisplayed. // At this point, the form has error, and should be redisplayed.
return $this->renderList(); return $this->renderList();
}
} }
/** /**
@@ -385,7 +386,6 @@ abstract class AbstractCrudController extends BaseAdminController
// Error (Default: false) // Error (Default: false)
$error_msg = false; $error_msg = false;
$ex = new \Exception();
// Create the Form from the request // Create the Form from the request
$changeForm = $this->getUpdateForm($this->getRequest()); $changeForm = $this->getUpdateForm($this->getRequest());
@@ -437,15 +437,17 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();*/ $error_msg = $ex->getMessage();*/
} }
// At this point, the form has errors, and should be redisplayed. if (false !=== $error_msg) {
$this->setupFormErrorContext( // At this point, the form has errors, and should be redisplayed.
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)), $this->setupFormErrorContext(
$error_msg, $this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
$changeForm, $error_msg,
$ex $changeForm,
); $ex
);
return $this->renderEditionTemplate(); return $this->renderEditionTemplate();
}
} }
/** /**