layout and clean activity reason crud

This commit is contained in:
2015-10-02 13:57:23 +02:00
parent 0bee5e46db
commit bebee4fbeb
8 changed files with 46 additions and 89 deletions

View File

@@ -101,11 +101,8 @@ class ActivityReasonCategoryController extends Controller
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillActivityBundle:ActivityReasonCategory:show.html.twig', array(
'entity' => $entity,
'delete_form' => $deleteForm->createView(),
));
}
@@ -124,12 +121,10 @@ class ActivityReasonCategoryController extends Controller
}
$editForm = $this->createEditForm($entity);
$deleteForm = $this->createDeleteForm($id);
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
@@ -165,7 +160,6 @@ class ActivityReasonCategoryController extends Controller
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$deleteForm = $this->createDeleteForm($id);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
@@ -178,47 +172,6 @@ class ActivityReasonCategoryController extends Controller
return $this->render('ChillActivityBundle:ActivityReasonCategory:edit.html.twig', array(
'entity' => $entity,
'edit_form' => $editForm->createView(),
'delete_form' => $deleteForm->createView(),
));
}
/**
* Deletes a ActivityReasonCategory entity.
*
*/
public function deleteAction(Request $request, $id)
{
$form = $this->createDeleteForm($id);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.');
}
$em->remove($entity);
$em->flush();
}
return $this->redirect($this->generateUrl('chill_activity_activityreasoncategory'));
}
/**
* Creates a form to delete a ActivityReasonCategory entity by id.
*
* @param mixed $id The entity id
*
* @return \Symfony\Component\Form\Form The form
*/
private function createDeleteForm($id)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_activity_activityreasoncategory_delete', array('id' => $id)))
->setMethod('DELETE')
->add('submit', 'submit', array('label' => 'Delete'))
->getForm()
;
}
}