Resolve "Static Content" #1149

Merged
korina.cordero merged 2 commits from 298-static-content into master 2020-01-17 08:31:22 +00:00
Showing only changes of commit 91e495f251 - Show all commits

View file

@ -134,7 +134,8 @@ class StaticContentController extends Controller
$row = new StaticContent();
// set and save values
$row->setID($req->request->get('id'));
$id = $req->request->get('id');
$row->setID($id);
$row->setContent($req->request->get('content'));
// validate
@ -143,6 +144,14 @@ class StaticContentController extends Controller
// initialize error list
$error_array = [];
// check for duplicate ID
$result = $em->getRepository(StaticContent::class)->find($id);
if ($result != null)
{
error_log($id);
$error_array['id'] = 'Duplicate ID exists.';
}
// add errors to list
foreach ($errors as $error) {
$error_array[$error->getPropertyPath()] = $error->getMessage();
@ -213,6 +222,14 @@ class StaticContentController extends Controller
// initialize error list
$error_array = [];
// check for duplicate ID
$result = $em->getRepository(StaticContent::class)->find($id);
if ($result != null)
{
error_log($id);
$error_array['id'] = 'Duplicate ID exists.';
}
// add errors to list
foreach ($errors as $error) {
$error_array[$error->getPropertyPath()] = $error->getMessage();