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,6 +335,7 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage(); $error_msg = $ex->getMessage();
} }
if (false !=== $error_msg) {
$this->setupFormErrorContext( $this->setupFormErrorContext(
$this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)), $this->getTranslator()->trans("%obj creation", array('%obj' => $this->objectName)),
$error_msg, $error_msg,
@@ -346,6 +346,7 @@ abstract class AbstractCrudController extends BaseAdminController
// 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();
} }
}
/** /**
* Load a object for modification, and display the edit template. * Load a object for modification, and display the edit template.
@@ -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,6 +437,7 @@ abstract class AbstractCrudController extends BaseAdminController
$error_msg = $ex->getMessage();*/ $error_msg = $ex->getMessage();*/
} }
if (false !=== $error_msg) {
// At this point, the form has errors, and should be redisplayed. // At this point, the form has errors, and should be redisplayed.
$this->setupFormErrorContext( $this->setupFormErrorContext(
$this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)), $this->getTranslator()->trans("%obj modification", array('%obj' => $this->objectName)),
@@ -447,6 +448,7 @@ abstract class AbstractCrudController extends BaseAdminController
return $this->renderEditionTemplate(); return $this->renderEditionTemplate();
} }
}
/** /**
* Update object position (only for objects whichsupport that) * Update object position (only for objects whichsupport that)