From 5738de5033b14ff1fba4bb0818acb0e2c7688bae Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Wed, 1 Jul 2015 13:34:14 +0200 Subject: [PATCH] Adding generated files --- Controller/ActivityController.php | 224 ++++++++++++++++++ .../ActivityReasonCategoryController.php | 224 ++++++++++++++++++ Controller/ActivityReasonController.php | 224 ++++++++++++++++++ Controller/ActivityTypeController.php | 224 ++++++++++++++++++ Form/ActivityReasonCategoryType.php | 40 ++++ Form/ActivityReasonType.php | 41 ++++ Form/ActivityType.php | 47 ++++ Form/ActivityTypeType.php | 39 +++ Resources/config/routing.yml | 16 ++ Resources/config/routing/activity.yml | 30 +++ Resources/config/routing/activityreason.yml | 30 +++ .../config/routing/activityreasoncategory.yml | 30 +++ Resources/config/routing/activitytype.yml | 30 +++ Resources/views/Activity/edit.html.twig | 16 ++ Resources/views/Activity/index.html.twig | 47 ++++ Resources/views/Activity/new.html.twig | 15 ++ Resources/views/Activity/show.html.twig | 44 ++++ Resources/views/ActivityReason/edit.html.twig | 16 ++ .../views/ActivityReason/index.html.twig | 43 ++++ Resources/views/ActivityReason/new.html.twig | 15 ++ Resources/views/ActivityReason/show.html.twig | 36 +++ .../ActivityReasonCategory/edit.html.twig | 16 ++ .../ActivityReasonCategory/index.html.twig | 43 ++++ .../ActivityReasonCategory/new.html.twig | 15 ++ .../ActivityReasonCategory/show.html.twig | 36 +++ Resources/views/ActivityType/edit.html.twig | 16 ++ Resources/views/ActivityType/index.html.twig | 41 ++++ Resources/views/ActivityType/new.html.twig | 15 ++ Resources/views/ActivityType/show.html.twig | 32 +++ Tests/Controller/ActivityControllerTest.php | 55 +++++ .../ActivityReasonCategoryControllerTest.php | 55 +++++ .../ActivityReasonControllerTest.php | 55 +++++ .../Controller/ActivityTypeControllerTest.php | 55 +++++ 33 files changed, 1865 insertions(+) create mode 100644 Controller/ActivityController.php create mode 100644 Controller/ActivityReasonCategoryController.php create mode 100644 Controller/ActivityReasonController.php create mode 100644 Controller/ActivityTypeController.php create mode 100644 Form/ActivityReasonCategoryType.php create mode 100644 Form/ActivityReasonType.php create mode 100644 Form/ActivityType.php create mode 100644 Form/ActivityTypeType.php create mode 100644 Resources/config/routing/activity.yml create mode 100644 Resources/config/routing/activityreason.yml create mode 100644 Resources/config/routing/activityreasoncategory.yml create mode 100644 Resources/config/routing/activitytype.yml create mode 100644 Resources/views/Activity/edit.html.twig create mode 100644 Resources/views/Activity/index.html.twig create mode 100644 Resources/views/Activity/new.html.twig create mode 100644 Resources/views/Activity/show.html.twig create mode 100644 Resources/views/ActivityReason/edit.html.twig create mode 100644 Resources/views/ActivityReason/index.html.twig create mode 100644 Resources/views/ActivityReason/new.html.twig create mode 100644 Resources/views/ActivityReason/show.html.twig create mode 100644 Resources/views/ActivityReasonCategory/edit.html.twig create mode 100644 Resources/views/ActivityReasonCategory/index.html.twig create mode 100644 Resources/views/ActivityReasonCategory/new.html.twig create mode 100644 Resources/views/ActivityReasonCategory/show.html.twig create mode 100644 Resources/views/ActivityType/edit.html.twig create mode 100644 Resources/views/ActivityType/index.html.twig create mode 100644 Resources/views/ActivityType/new.html.twig create mode 100644 Resources/views/ActivityType/show.html.twig create mode 100644 Tests/Controller/ActivityControllerTest.php create mode 100644 Tests/Controller/ActivityReasonCategoryControllerTest.php create mode 100644 Tests/Controller/ActivityReasonControllerTest.php create mode 100644 Tests/Controller/ActivityTypeControllerTest.php diff --git a/Controller/ActivityController.php b/Controller/ActivityController.php new file mode 100644 index 000000000..4ecc17ac3 --- /dev/null +++ b/Controller/ActivityController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillActivityBundle:Activity')->findAll(); + + return $this->render('ChillActivityBundle:Activity:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new Activity entity. + * + */ + public function createAction(Request $request) + { + $entity = new Activity(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('activity_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillActivityBundle:Activity:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a Activity entity. + * + * @param Activity $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(Activity $entity) + { + $form = $this->createForm(new ActivityType(), $entity, array( + 'action' => $this->generateUrl('activity_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new Activity entity. + * + */ + public function newAction() + { + $entity = new Activity(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillActivityBundle:Activity:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a Activity entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Activity entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:Activity:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing Activity entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Activity entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:Activity:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a Activity entity. + * + * @param Activity $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(Activity $entity) + { + $form = $this->createForm(new ActivityType(), $entity, array( + 'action' => $this->generateUrl('activity_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing Activity entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:Activity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Activity entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('activity_edit', array('id' => $id))); + } + + return $this->render('ChillActivityBundle:Activity:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a Activity 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:Activity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Activity entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('activity')); + } + + /** + * Creates a form to delete a Activity 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('activity_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/ActivityReasonCategoryController.php b/Controller/ActivityReasonCategoryController.php new file mode 100644 index 000000000..5d7208377 --- /dev/null +++ b/Controller/ActivityReasonCategoryController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->findAll(); + + return $this->render('ChillActivityBundle:ActivityReasonCategory:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new ActivityReasonCategory entity. + * + */ + public function createAction(Request $request) + { + $entity = new ActivityReasonCategory(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('activityreasoncategory_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a ActivityReasonCategory entity. + * + * @param ActivityReasonCategory $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(ActivityReasonCategory $entity) + { + $form = $this->createForm(new ActivityReasonCategoryType(), $entity, array( + 'action' => $this->generateUrl('activityreasoncategory_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new ActivityReasonCategory entity. + * + */ + public function newAction() + { + $entity = new ActivityReasonCategory(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillActivityBundle:ActivityReasonCategory:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a ActivityReasonCategory entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id); + + if (!$entity) { + 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(), + )); + } + + /** + * Displays a form to edit an existing ActivityReasonCategory entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); + } + + $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(), + )); + } + + /** + * Creates a form to edit a ActivityReasonCategory entity. + * + * @param ActivityReasonCategory $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(ActivityReasonCategory $entity) + { + $form = $this->createForm(new ActivityReasonCategoryType(), $entity, array( + 'action' => $this->generateUrl('activityreasoncategory_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing ActivityReasonCategory entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReasonCategory')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReasonCategory entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('activityreasoncategory_edit', array('id' => $id))); + } + + 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('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('activityreasoncategory_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/ActivityReasonController.php b/Controller/ActivityReasonController.php new file mode 100644 index 000000000..6f46efe21 --- /dev/null +++ b/Controller/ActivityReasonController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillActivityBundle:ActivityReason')->findAll(); + + return $this->render('ChillActivityBundle:ActivityReason:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new ActivityReason entity. + * + */ + public function createAction(Request $request) + { + $entity = new ActivityReason(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('activityreason_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a ActivityReason entity. + * + * @param ActivityReason $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(ActivityReason $entity) + { + $form = $this->createForm(new ActivityReasonType(), $entity, array( + 'action' => $this->generateUrl('activityreason_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new ActivityReason entity. + * + */ + public function newAction() + { + $entity = new ActivityReason(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillActivityBundle:ActivityReason:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a ActivityReason entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReason entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:ActivityReason:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing ActivityReason entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReason entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a ActivityReason entity. + * + * @param ActivityReason $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(ActivityReason $entity) + { + $form = $this->createForm(new ActivityReasonType(), $entity, array( + 'action' => $this->generateUrl('activityreason_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing ActivityReason entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityReason')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReason entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('activityreason_edit', array('id' => $id))); + } + + return $this->render('ChillActivityBundle:ActivityReason:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a ActivityReason 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:ActivityReason')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityReason entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('activityreason')); + } + + /** + * Creates a form to delete a ActivityReason 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('activityreason_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/ActivityTypeController.php b/Controller/ActivityTypeController.php new file mode 100644 index 000000000..6ca00c1d2 --- /dev/null +++ b/Controller/ActivityTypeController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillActivityBundle:ActivityType')->findAll(); + + return $this->render('ChillActivityBundle:ActivityType:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new ActivityType entity. + * + */ + public function createAction(Request $request) + { + $entity = new ActivityType(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('activitytype_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a ActivityType entity. + * + * @param ActivityType $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(ActivityType $entity) + { + $form = $this->createForm(new ActivityTypeType(), $entity, array( + 'action' => $this->generateUrl('activitytype_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new ActivityType entity. + * + */ + public function newAction() + { + $entity = new ActivityType(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillActivityBundle:ActivityType:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a ActivityType entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityType entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:ActivityType:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing ActivityType entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityType entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a ActivityType entity. + * + * @param ActivityType $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(ActivityType $entity) + { + $form = $this->createForm(new ActivityTypeType(), $entity, array( + 'action' => $this->generateUrl('activitytype_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing ActivityType entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillActivityBundle:ActivityType')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityType entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('activitytype_edit', array('id' => $id))); + } + + return $this->render('ChillActivityBundle:ActivityType:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a ActivityType 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:ActivityType')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find ActivityType entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('activitytype')); + } + + /** + * Creates a form to delete a ActivityType 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('activitytype_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Form/ActivityReasonCategoryType.php b/Form/ActivityReasonCategoryType.php new file mode 100644 index 000000000..4b21f3e3c --- /dev/null +++ b/Form/ActivityReasonCategoryType.php @@ -0,0 +1,40 @@ +add('label') + ->add('active') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\ActivityBundle\Entity\ActivityReasonCategory' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'chill_activitybundle_activityreasoncategory'; + } +} diff --git a/Form/ActivityReasonType.php b/Form/ActivityReasonType.php new file mode 100644 index 000000000..43704fe03 --- /dev/null +++ b/Form/ActivityReasonType.php @@ -0,0 +1,41 @@ +add('label') + ->add('active') + ->add('category') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\ActivityBundle\Entity\ActivityReason' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'chill_activitybundle_activityreason'; + } +} diff --git a/Form/ActivityType.php b/Form/ActivityType.php new file mode 100644 index 000000000..b51e9af28 --- /dev/null +++ b/Form/ActivityType.php @@ -0,0 +1,47 @@ +add('date') + ->add('durationTime') + ->add('remark') + ->add('attendee') + ->add('user') + ->add('scope') + ->add('reason') + ->add('type') + ->add('person') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\ActivityBundle\Entity\Activity' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'chill_activitybundle_activity'; + } +} diff --git a/Form/ActivityTypeType.php b/Form/ActivityTypeType.php new file mode 100644 index 000000000..cbc5d5afa --- /dev/null +++ b/Form/ActivityTypeType.php @@ -0,0 +1,39 @@ +add('name') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\ActivityBundle\Entity\ActivityType' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'chill_activitybundle_activitytype'; + } +} diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml index 6f006d159..9f70adcf7 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -1,3 +1,19 @@ +chill_activity_activity: + resource: "@ChillActivityBundle/Resources/config/routing/activity.yml" + prefix: /activity + +chill_activity_activityreason: + resource: "@ChillActivityBundle/Resources/config/routing/activityreason.yml" + prefix: /activityreason + +chill_activity_activityreasoncategory: + resource: "@ChillActivityBundle/Resources/config/routing/activityreasoncategory.yml" + prefix: /activityreasoncategory + +chill_activity_activitytype: + resource: "@ChillActivityBundle/Resources/config/routing/activitytype.yml" + prefix: /activitytype + chill_activity_homepage: path: /hello/{name} defaults: { _controller: ChillActivityBundle:Default:index } diff --git a/Resources/config/routing/activity.yml b/Resources/config/routing/activity.yml new file mode 100644 index 000000000..9efeac928 --- /dev/null +++ b/Resources/config/routing/activity.yml @@ -0,0 +1,30 @@ +activity: + path: / + defaults: { _controller: "ChillActivityBundle:Activity:index" } + +activity_show: + path: /{id}/show + defaults: { _controller: "ChillActivityBundle:Activity:show" } + +activity_new: + path: /new + defaults: { _controller: "ChillActivityBundle:Activity:new" } + +activity_create: + path: /create + defaults: { _controller: "ChillActivityBundle:Activity:create" } + methods: POST + +activity_edit: + path: /{id}/edit + defaults: { _controller: "ChillActivityBundle:Activity:edit" } + +activity_update: + path: /{id}/update + defaults: { _controller: "ChillActivityBundle:Activity:update" } + methods: [POST, PUT] + +activity_delete: + path: /{id}/delete + defaults: { _controller: "ChillActivityBundle:Activity:delete" } + methods: [POST, DELETE] diff --git a/Resources/config/routing/activityreason.yml b/Resources/config/routing/activityreason.yml new file mode 100644 index 000000000..367982cc5 --- /dev/null +++ b/Resources/config/routing/activityreason.yml @@ -0,0 +1,30 @@ +activityreason: + path: / + defaults: { _controller: "ChillActivityBundle:ActivityReason:index" } + +activityreason_show: + path: /{id}/show + defaults: { _controller: "ChillActivityBundle:ActivityReason:show" } + +activityreason_new: + path: /new + defaults: { _controller: "ChillActivityBundle:ActivityReason:new" } + +activityreason_create: + path: /create + defaults: { _controller: "ChillActivityBundle:ActivityReason:create" } + methods: POST + +activityreason_edit: + path: /{id}/edit + defaults: { _controller: "ChillActivityBundle:ActivityReason:edit" } + +activityreason_update: + path: /{id}/update + defaults: { _controller: "ChillActivityBundle:ActivityReason:update" } + methods: [POST, PUT] + +activityreason_delete: + path: /{id}/delete + defaults: { _controller: "ChillActivityBundle:ActivityReason:delete" } + methods: [POST, DELETE] diff --git a/Resources/config/routing/activityreasoncategory.yml b/Resources/config/routing/activityreasoncategory.yml new file mode 100644 index 000000000..f318ef408 --- /dev/null +++ b/Resources/config/routing/activityreasoncategory.yml @@ -0,0 +1,30 @@ +activityreasoncategory: + path: / + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:index" } + +activityreasoncategory_show: + path: /{id}/show + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:show" } + +activityreasoncategory_new: + path: /new + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:new" } + +activityreasoncategory_create: + path: /create + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:create" } + methods: POST + +activityreasoncategory_edit: + path: /{id}/edit + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:edit" } + +activityreasoncategory_update: + path: /{id}/update + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:update" } + methods: [POST, PUT] + +activityreasoncategory_delete: + path: /{id}/delete + defaults: { _controller: "ChillActivityBundle:ActivityReasonCategory:delete" } + methods: [POST, DELETE] diff --git a/Resources/config/routing/activitytype.yml b/Resources/config/routing/activitytype.yml new file mode 100644 index 000000000..c850cf3ca --- /dev/null +++ b/Resources/config/routing/activitytype.yml @@ -0,0 +1,30 @@ +activitytype: + path: / + defaults: { _controller: "ChillActivityBundle:ActivityType:index" } + +activitytype_show: + path: /{id}/show + defaults: { _controller: "ChillActivityBundle:ActivityType:show" } + +activitytype_new: + path: /new + defaults: { _controller: "ChillActivityBundle:ActivityType:new" } + +activitytype_create: + path: /create + defaults: { _controller: "ChillActivityBundle:ActivityType:create" } + methods: POST + +activitytype_edit: + path: /{id}/edit + defaults: { _controller: "ChillActivityBundle:ActivityType:edit" } + +activitytype_update: + path: /{id}/update + defaults: { _controller: "ChillActivityBundle:ActivityType:update" } + methods: [POST, PUT] + +activitytype_delete: + path: /{id}/delete + defaults: { _controller: "ChillActivityBundle:ActivityType:delete" } + methods: [POST, DELETE] diff --git a/Resources/views/Activity/edit.html.twig b/Resources/views/Activity/edit.html.twig new file mode 100644 index 000000000..846ec0bc5 --- /dev/null +++ b/Resources/views/Activity/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Activity edit

+ + {{ form(edit_form) }} + + +{% endblock %} diff --git a/Resources/views/Activity/index.html.twig b/Resources/views/Activity/index.html.twig new file mode 100644 index 000000000..c13361585 --- /dev/null +++ b/Resources/views/Activity/index.html.twig @@ -0,0 +1,47 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Activity list

+ + + + + + + + + + + + + + {% for entity in entities %} + + + + + + + + + {% endfor %} + +
IdDateDurationtimeRemarkAttendeeActions
{{ entity.id }}{% if entity.date %}{{ entity.date|date('Y-m-d H:i:s') }}{% endif %}{{ entity.durationTime }}{{ entity.remark }}{{ entity.attendee }} + +
+ + + {% endblock %} diff --git a/Resources/views/Activity/new.html.twig b/Resources/views/Activity/new.html.twig new file mode 100644 index 000000000..94c3169e7 --- /dev/null +++ b/Resources/views/Activity/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Activity creation

+ + {{ form(form) }} + + +{% endblock %} diff --git a/Resources/views/Activity/show.html.twig b/Resources/views/Activity/show.html.twig new file mode 100644 index 000000000..eb939fcc4 --- /dev/null +++ b/Resources/views/Activity/show.html.twig @@ -0,0 +1,44 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Activity

+ + + + + + + + + + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Date{{ entity.date|date('Y-m-d H:i:s') }}
Durationtime{{ entity.durationTime }}
Remark{{ entity.remark }}
Attendee{{ entity.attendee }}
+ + +{% endblock %} diff --git a/Resources/views/ActivityReason/edit.html.twig b/Resources/views/ActivityReason/edit.html.twig new file mode 100644 index 000000000..d2db39938 --- /dev/null +++ b/Resources/views/ActivityReason/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReason edit

+ + {{ form(edit_form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityReason/index.html.twig b/Resources/views/ActivityReason/index.html.twig new file mode 100644 index 000000000..947381a8a --- /dev/null +++ b/Resources/views/ActivityReason/index.html.twig @@ -0,0 +1,43 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReason list

+ + + + + + + + + + + + {% for entity in entities %} + + + + + + + {% endfor %} + +
IdLabelActiveActions
{{ entity.id }}{{ entity.label }}{{ entity.active }} + +
+ + + {% endblock %} diff --git a/Resources/views/ActivityReason/new.html.twig b/Resources/views/ActivityReason/new.html.twig new file mode 100644 index 000000000..b37d3bf10 --- /dev/null +++ b/Resources/views/ActivityReason/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReason creation

+ + {{ form(form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityReason/show.html.twig b/Resources/views/ActivityReason/show.html.twig new file mode 100644 index 000000000..d287fc07c --- /dev/null +++ b/Resources/views/ActivityReason/show.html.twig @@ -0,0 +1,36 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReason

+ + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Label{{ entity.label }}
Active{{ entity.active }}
+ + +{% endblock %} diff --git a/Resources/views/ActivityReasonCategory/edit.html.twig b/Resources/views/ActivityReasonCategory/edit.html.twig new file mode 100644 index 000000000..7fefcef98 --- /dev/null +++ b/Resources/views/ActivityReasonCategory/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReasonCategory edit

+ + {{ form(edit_form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityReasonCategory/index.html.twig b/Resources/views/ActivityReasonCategory/index.html.twig new file mode 100644 index 000000000..7979148c7 --- /dev/null +++ b/Resources/views/ActivityReasonCategory/index.html.twig @@ -0,0 +1,43 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReasonCategory list

+ + + + + + + + + + + + {% for entity in entities %} + + + + + + + {% endfor %} + +
IdLabelActiveActions
{{ entity.id }}{{ entity.label }}{{ entity.active }} + +
+ + + {% endblock %} diff --git a/Resources/views/ActivityReasonCategory/new.html.twig b/Resources/views/ActivityReasonCategory/new.html.twig new file mode 100644 index 000000000..feddcfed8 --- /dev/null +++ b/Resources/views/ActivityReasonCategory/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReasonCategory creation

+ + {{ form(form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityReasonCategory/show.html.twig b/Resources/views/ActivityReasonCategory/show.html.twig new file mode 100644 index 000000000..bd9bb4bb2 --- /dev/null +++ b/Resources/views/ActivityReasonCategory/show.html.twig @@ -0,0 +1,36 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityReasonCategory

+ + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Label{{ entity.label }}
Active{{ entity.active }}
+ + +{% endblock %} diff --git a/Resources/views/ActivityType/edit.html.twig b/Resources/views/ActivityType/edit.html.twig new file mode 100644 index 000000000..aa88e761c --- /dev/null +++ b/Resources/views/ActivityType/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityType edit

+ + {{ form(edit_form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityType/index.html.twig b/Resources/views/ActivityType/index.html.twig new file mode 100644 index 000000000..0dc63aad3 --- /dev/null +++ b/Resources/views/ActivityType/index.html.twig @@ -0,0 +1,41 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityType list

+ + + + + + + + + + + {% for entity in entities %} + + + + + + {% endfor %} + +
IdNameActions
{{ entity.id }}{{ entity.name }} + +
+ + + {% endblock %} diff --git a/Resources/views/ActivityType/new.html.twig b/Resources/views/ActivityType/new.html.twig new file mode 100644 index 000000000..7e43c1668 --- /dev/null +++ b/Resources/views/ActivityType/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityType creation

+ + {{ form(form) }} + + +{% endblock %} diff --git a/Resources/views/ActivityType/show.html.twig b/Resources/views/ActivityType/show.html.twig new file mode 100644 index 000000000..08aa01aff --- /dev/null +++ b/Resources/views/ActivityType/show.html.twig @@ -0,0 +1,32 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

ActivityType

+ + + + + + + + + + + + +
Id{{ entity.id }}
Name{{ entity.name }}
+ + +{% endblock %} diff --git a/Tests/Controller/ActivityControllerTest.php b/Tests/Controller/ActivityControllerTest.php new file mode 100644 index 000000000..2a0cb3c21 --- /dev/null +++ b/Tests/Controller/ActivityControllerTest.php @@ -0,0 +1,55 @@ +request('GET', '/activity/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /activity/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'chill_activitybundle_activity[field_name]' => 'Test', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check data in the show view + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); + + // Edit the entity + $crawler = $client->click($crawler->selectLink('Edit')->link()); + + $form = $crawler->selectButton('Update')->form(array( + 'chill_activitybundle_activity[field_name]' => 'Foo', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check the element contains an attribute with value equals "Foo" + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); + + // Delete the entity + $client->submit($crawler->selectButton('Delete')->form()); + $crawler = $client->followRedirect(); + + // Check the entity has been delete on the list + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + } + + */ +} diff --git a/Tests/Controller/ActivityReasonCategoryControllerTest.php b/Tests/Controller/ActivityReasonCategoryControllerTest.php new file mode 100644 index 000000000..09dbbfb86 --- /dev/null +++ b/Tests/Controller/ActivityReasonCategoryControllerTest.php @@ -0,0 +1,55 @@ +request('GET', '/activityreasoncategory/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /activityreasoncategory/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'chill_activitybundle_activityreasoncategory[field_name]' => 'Test', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check data in the show view + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); + + // Edit the entity + $crawler = $client->click($crawler->selectLink('Edit')->link()); + + $form = $crawler->selectButton('Update')->form(array( + 'chill_activitybundle_activityreasoncategory[field_name]' => 'Foo', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check the element contains an attribute with value equals "Foo" + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); + + // Delete the entity + $client->submit($crawler->selectButton('Delete')->form()); + $crawler = $client->followRedirect(); + + // Check the entity has been delete on the list + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + } + + */ +} diff --git a/Tests/Controller/ActivityReasonControllerTest.php b/Tests/Controller/ActivityReasonControllerTest.php new file mode 100644 index 000000000..d1adc9ca4 --- /dev/null +++ b/Tests/Controller/ActivityReasonControllerTest.php @@ -0,0 +1,55 @@ +request('GET', '/activityreason/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /activityreason/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'chill_activitybundle_activityreason[field_name]' => 'Test', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check data in the show view + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); + + // Edit the entity + $crawler = $client->click($crawler->selectLink('Edit')->link()); + + $form = $crawler->selectButton('Update')->form(array( + 'chill_activitybundle_activityreason[field_name]' => 'Foo', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check the element contains an attribute with value equals "Foo" + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); + + // Delete the entity + $client->submit($crawler->selectButton('Delete')->form()); + $crawler = $client->followRedirect(); + + // Check the entity has been delete on the list + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + } + + */ +} diff --git a/Tests/Controller/ActivityTypeControllerTest.php b/Tests/Controller/ActivityTypeControllerTest.php new file mode 100644 index 000000000..07c72c3dd --- /dev/null +++ b/Tests/Controller/ActivityTypeControllerTest.php @@ -0,0 +1,55 @@ +request('GET', '/activitytype/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /activitytype/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'chill_activitybundle_activitytype[field_name]' => 'Test', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check data in the show view + $this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")'); + + // Edit the entity + $crawler = $client->click($crawler->selectLink('Edit')->link()); + + $form = $crawler->selectButton('Update')->form(array( + 'chill_activitybundle_activitytype[field_name]' => 'Foo', + // ... other fields to fill + )); + + $client->submit($form); + $crawler = $client->followRedirect(); + + // Check the element contains an attribute with value equals "Foo" + $this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]'); + + // Delete the entity + $client->submit($crawler->selectButton('Delete')->form()); + $crawler = $client->followRedirect(); + + // Check the entity has been delete on the list + $this->assertNotRegExp('/Foo/', $client->getResponse()->getContent()); + } + + */ +}