diff --git a/.htaccess b/.htaccess new file mode 100644 index 000000000..fb1de45bd --- /dev/null +++ b/.htaccess @@ -0,0 +1,7 @@ + + Require all denied + + + Order deny,allow + Deny from all + diff --git a/ChillCustomFieldsBundle.php b/ChillCustomFieldsBundle.php new file mode 100644 index 000000000..7150e5026 --- /dev/null +++ b/ChillCustomFieldsBundle.php @@ -0,0 +1,15 @@ +addCompilerPass(new CustomFieldCompilerPass()); + } +} diff --git a/Controller/AdressController.php b/Controller/AdressController.php new file mode 100644 index 000000000..1a64204cc --- /dev/null +++ b/Controller/AdressController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillCustomFieldsBundle:Adress')->findAll(); + + return $this->render('ChillCustomFieldsBundle:Adress:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new Adress entity. + * + */ + public function createAction(Request $request) + { + $entity = new Adress(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('adress_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillCustomFieldsBundle:Adress:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a Adress entity. + * + * @param Adress $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(Adress $entity) + { + $form = $this->createForm(new AdressType(), $entity, array( + 'action' => $this->generateUrl('adress_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new Adress entity. + * + */ + public function newAction() + { + $entity = new Adress(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillCustomFieldsBundle:Adress:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a Adress entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Adress entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:Adress:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing Adress entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Adress entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:Adress:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a Adress entity. + * + * @param Adress $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(Adress $entity) + { + $form = $this->createForm(new AdressType(), $entity, array( + 'action' => $this->generateUrl('adress_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing Adress entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Adress entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('adress_edit', array('id' => $id))); + } + + return $this->render('ChillCustomFieldsBundle:Adress:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a Adress entity. + * + */ + public function deleteAction(Request $request, $id) + { + $form = $this->createDeleteForm($id); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:Adress')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find Adress entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('adress')); + } + + /** + * Creates a form to delete a Adress 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('adress_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/BlopEntity2Controller.php b/Controller/BlopEntity2Controller.php new file mode 100644 index 000000000..9b14e753c --- /dev/null +++ b/Controller/BlopEntity2Controller.php @@ -0,0 +1,226 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->findAll(); + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new BlopEntity2 entity. + * + */ + public function createAction(Request $request) + { + $entity = new BlopEntity2(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('blopentity2_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a BlopEntity2 entity. + * + * @param BlopEntity2 $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(BlopEntity2 $entity) + { + $form = $this->createForm(new BlopEntity2Type(), $entity, array( + 'action' => $this->generateUrl('blopentity2_create'), + 'method' => 'POST', + 'em' => $this->getDoctrine()->getManager(), + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new BlopEntity2 entity. + * + */ + public function newAction() + { + $entity = new BlopEntity2(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a BlopEntity2 entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity2 entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing BlopEntity2 entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity2 entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a BlopEntity2 entity. + * + * @param BlopEntity2 $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(BlopEntity2 $entity) + { + $form = $this->createForm(new BlopEntity2Type(), $entity, array( + 'action' => $this->generateUrl('blopentity2_update', array('id' => $entity->getId())), + 'method' => 'PUT', + 'em' => $this->getDoctrine()->getManager(), + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing BlopEntity2 entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity2 entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('blopentity2_edit', array('id' => $id))); + } + + return $this->render('ChillCustomFieldsBundle:BlopEntity2:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a BlopEntity2 entity. + * + */ + public function deleteAction(Request $request, $id) + { + $form = $this->createDeleteForm($id); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity2')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity2 entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('blopentity2')); + } + + /** + * Creates a form to delete a BlopEntity2 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('blopentity2_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/BlopEntityController.php b/Controller/BlopEntityController.php new file mode 100644 index 000000000..3f833f05d --- /dev/null +++ b/Controller/BlopEntityController.php @@ -0,0 +1,291 @@ +getDoctrine()->getManager(); + + $customFields = $em->getRepository('ChillCustomFieldsBundle:CustomField') + ->findAll(); + + $customFieldsLablels = array_map( + function($e) { return $e->getLabel(); }, + $customFields); + + $customFieldsByLabel = array_combine($customFieldsLablels, $customFields); + + if (array_key_exists($key,$customFieldsByLabel)) { + $customFieldConfig = $customFieldsByLabel[$key]; + if($customFieldConfig->getType() === 'OneToMany(Adress)') { + $manyToOneEntity = new AdressType(); + $form = $this->createCreateForm($manyToOneEntity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($manyToOneEntity); + $em->flush(); + + $blopEntity = $this->om + ->getRepository('ChillCustomFieldsBundle:CustomField') + ->findOneById($id); + + $blopEntityCustomFieldArray = json_decode($blopEntity->getCustomField()); + $blopEntityCustomFieldArray[$key][] = $manyToOneEntity->getId(); + } + } else { + // PAS MANY TO ONE + throw new Exception("Error Processing Request", 1); + } + } else { + // PAS RENSEIGNE COMME CF + throw new Exception("Error Processing Request", 1); + } + } + + /** + * Lists all BlopEntity entities. + * + */ + public function indexAction() + { + $em = $this->getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->findAll(); + + return $this->render('ChillCustomFieldsBundle:BlopEntity:index.html.twig', array( + 'entities' => $entities, + )); + } + + public function cfSetAction($id,$key,$value) + { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + echo $entity->cfSet($key,$value); + var_dump($entity->getCustomField()); + $em->persist($entity); + $em->flush(); + return null;//$entity->cfSet($key,$value); + } + + public function cfGetAction($id,$key) + { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + echo $entity->cfGet($key); + return null;//return $entity->cfGet($key); + } + + /** + * Creates a new BlopEntity entity. + * + */ + public function createAction(Request $request) + { + $entity = new BlopEntity(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('blopentity_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillCustomFieldsBundle:BlopEntity:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a BlopEntity entity. + * + * @param BlopEntity $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(BlopEntity $entity) + { + $form = $this->createForm(new BlopEntityType(), $entity, array( + 'action' => $this->generateUrl('blopentity_create'), + 'method' => 'POST', + 'em' => $this->getDoctrine()->getManager(), + )); + + + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new BlopEntity entity. + * + */ + public function newAction() + { + $entity = new BlopEntity(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillCustomFieldsBundle:BlopEntity:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a BlopEntity entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:BlopEntity:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing BlopEntity entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:BlopEntity:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a BlopEntity entity. + * + * @param BlopEntity $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(BlopEntity $entity) + { + $form = $this->createForm(new BlopEntityType(), $entity, array( + 'action' => $this->generateUrl('blopentity_update', array('id' => $entity->getId())), + 'method' => 'PUT', + 'em' => $this->getDoctrine()->getManager(), + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing BlopEntity entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('blopentity_edit', array('id' => $id))); + } + + return $this->render('ChillCustomFieldsBundle:BlopEntity:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a BlopEntity entity. + * + */ + public function deleteAction(Request $request, $id) + { + $form = $this->createDeleteForm($id); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:BlopEntity')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find BlopEntity entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('blopentity')); + } + + /** + * Creates a form to delete a BlopEntity 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('blopentity_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/CustomFieldController.php b/Controller/CustomFieldController.php new file mode 100644 index 000000000..adb88edd9 --- /dev/null +++ b/Controller/CustomFieldController.php @@ -0,0 +1,247 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillCustomFieldsBundle:CustomField')->findAll(); + + //prepare form for new custom type + $fieldChoices = array(); + foreach ($this->get('chill.custom_field_compiler')->getAllFields() + as $key => $customType) { + $fieldChoices[$key] = $customType->getName(); + } + $form = $this->get('form.factory') + ->createNamedBuilder(null, 'form', null, array( + 'method' => 'GET', + 'action' => $this->generateUrl('customfield_new'), + 'csrf_protection' => false + )) + ->add('type', 'choice', array( + 'choices' => $fieldChoices + )) + ->getForm(); + + return $this->render('ChillCustomFieldsBundle:CustomField:index.html.twig', array( + 'entities' => $entities, + 'form' => $form->createView() + )); + } + + + /** + * Creates a new CustomField entity. + * + */ + public function createAction(Request $request) + { + $entity = new CustomField(); + $form = $this->createCreateForm($entity, $request->query->get('type', null)); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('customfield_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a CustomField entity. + * + * @param CustomField $entity The entity + * @param string + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(CustomField $entity, $type) + { + $form = $this->createForm('custom_field_choice', $entity, array( + 'action' => $this->generateUrl('customfield_create', + array('type' => $type)), + 'method' => 'POST', + 'type' => $type + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new CustomField entity. + * + */ + public function newAction(Request $request) + { + $entity = new CustomField(); + $form = $this->createCreateForm($entity, $request->query->get('type')); + + return $this->render('ChillCustomFieldsBundle:CustomField:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a CustomField entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomField entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:CustomField:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing CustomField entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomField entity.'); + } + + $editForm = $this->createEditForm($entity, $entity->getType()); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a CustomField entity. + * + * @param CustomField $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(CustomField $entity, $type) + { + $form = $this->createForm('custom_field_choice', $entity, array( + 'action' => $this->generateUrl('customfield_update', array('id' => $entity->getId())), + 'method' => 'PUT', + 'type' => $type + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing CustomField entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomField entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('customfield_edit', array('id' => $id))); + } + + return $this->render('ChillCustomFieldsBundle:CustomField:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a CustomField entity. + * + */ + public function deleteAction(Request $request, $id) + { + $form = $this->createDeleteForm($id); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomField')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomField entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('customfield')); + } + + /** + * Creates a form to delete a CustomField 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('customfield_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/CustomFieldsGroupController.php b/Controller/CustomFieldsGroupController.php new file mode 100644 index 000000000..bd8ff2b0f --- /dev/null +++ b/Controller/CustomFieldsGroupController.php @@ -0,0 +1,224 @@ +getDoctrine()->getManager(); + + $entities = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->findAll(); + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:index.html.twig', array( + 'entities' => $entities, + )); + } + /** + * Creates a new CustomFieldsGroup entity. + * + */ + public function createAction(Request $request) + { + $entity = new CustomFieldsGroup(); + $form = $this->createCreateForm($entity); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + + return $this->redirect($this->generateUrl('customfieldsgroup_show', array('id' => $entity->getId()))); + } + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Creates a form to create a CustomFieldsGroup entity. + * + * @param CustomFieldsGroup $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createCreateForm(CustomFieldsGroup $entity) + { + $form = $this->createForm('custom_fields_group', $entity, array( + 'action' => $this->generateUrl('customfieldsgroup_create'), + 'method' => 'POST', + )); + + $form->add('submit', 'submit', array('label' => 'Create')); + + return $form; + } + + /** + * Displays a form to create a new CustomFieldsGroup entity. + * + */ + public function newAction() + { + $entity = new CustomFieldsGroup(); + $form = $this->createCreateForm($entity); + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array( + 'entity' => $entity, + 'form' => $form->createView(), + )); + } + + /** + * Finds and displays a CustomFieldsGroup entity. + * + */ + public function showAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:show.html.twig', array( + 'entity' => $entity, + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Displays a form to edit an existing CustomFieldsGroup entity. + * + */ + public function editAction($id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); + } + + $editForm = $this->createEditForm($entity); + $deleteForm = $this->createDeleteForm($id); + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + + /** + * Creates a form to edit a CustomFieldsGroup entity. + * + * @param CustomFieldsGroup $entity The entity + * + * @return \Symfony\Component\Form\Form The form + */ + private function createEditForm(CustomFieldsGroup $entity) + { + $form = $this->createForm('custom_fields_group', $entity, array( + 'action' => $this->generateUrl('customfieldsgroup_update', array('id' => $entity->getId())), + 'method' => 'PUT', + )); + + $form->add('submit', 'submit', array('label' => 'Update')); + + return $form; + } + /** + * Edits an existing CustomFieldsGroup entity. + * + */ + public function updateAction(Request $request, $id) + { + $em = $this->getDoctrine()->getManager(); + + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); + } + + $deleteForm = $this->createDeleteForm($id); + $editForm = $this->createEditForm($entity); + $editForm->handleRequest($request); + + if ($editForm->isValid()) { + $em->flush(); + + return $this->redirect($this->generateUrl('customfieldsgroup_edit', array('id' => $id))); + } + + return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:edit.html.twig', array( + 'entity' => $entity, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + )); + } + /** + * Deletes a CustomFieldsGroup entity. + * + */ + public function deleteAction(Request $request, $id) + { + $form = $this->createDeleteForm($id); + $form->handleRequest($request); + + if ($form->isValid()) { + $em = $this->getDoctrine()->getManager(); + $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); + + if (!$entity) { + throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); + } + + $em->remove($entity); + $em->flush(); + } + + return $this->redirect($this->generateUrl('customfieldsgroup')); + } + + /** + * Creates a form to delete a CustomFieldsGroup 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('customfieldsgroup_delete', array('id' => $id))) + ->setMethod('DELETE') + ->add('submit', 'submit', array('label' => 'Delete')) + ->getForm() + ; + } +} diff --git a/Controller/DefaultController.php b/Controller/DefaultController.php new file mode 100644 index 000000000..b1f433c36 --- /dev/null +++ b/Controller/DefaultController.php @@ -0,0 +1,13 @@ +render('ChillCustomFieldsBundle:Default:index.html.twig', array('name' => $name)); + } +} diff --git a/CustomFields/CustomFieldAddress.php b/CustomFields/CustomFieldAddress.php new file mode 100644 index 000000000..dbcf5efd9 --- /dev/null +++ b/CustomFields/CustomFieldAddress.php @@ -0,0 +1,91 @@ + + */ +class CustomFieldAddress implements CustomFieldInterface +{ + + /** + * + * @var EntityManagerInterface + */ + public $om; + + public function __construct(EntityManagerInterface $om) + { + $this->om = $om; + } + + public function buildForm(FormBuilderInterface $builder, CustomField $customField) + { + $builder->add( + $builder->create('address', 'entity', array( + 'class' => 'ChillCustomFieldsBundle:Adress', + 'multiple' => true, + 'expanded' => true + ) + )->addModelTransformer(new CustomFieldDataTransformer( + $this, + $customField) + ) + ); + } + + public function getName() + { + return 'CF address'; + } + + public function render($value, CustomField $customField) + { + + } + + public function buildOptionsForm(FormBuilderInterface $builder) + { + return null; + } + + public function deserialize($serialized, CustomField $customField) + { +// if ($serialized === NULL) { +// return null; +// } +// +// return $this->om->getRepository('ChillCustomFieldsBundle:Adress') +// ->find($serialized); + + return $this->om->getRepository('ChillCustomFieldsBundle:Adress') + ->findBy(array('id' => $serialized)); + } + + /** + * + * @param \Chill\CustomFieldsBundle\Entity\Adress $value + * @param CustomField $customField + * @return type + */ + public function serialize($value, CustomField $customField) + { + $arrayId = array(); + + foreach($value as $address) { + $arrayId[] = $address->getId(); + } + + return $arrayId; + } + +} diff --git a/CustomFields/CustomFieldChoiceWithOther.php b/CustomFields/CustomFieldChoiceWithOther.php new file mode 100644 index 000000000..9b0085f2f --- /dev/null +++ b/CustomFields/CustomFieldChoiceWithOther.php @@ -0,0 +1,19 @@ + + */ +class CustomFieldChoiceWithOther +{ + //put your code here +} diff --git a/CustomFields/CustomFieldInterface.php b/CustomFields/CustomFieldInterface.php new file mode 100644 index 000000000..5d1e1b978 --- /dev/null +++ b/CustomFields/CustomFieldInterface.php @@ -0,0 +1,57 @@ + + */ +interface CustomFieldInterface +{ + + /** + * + * @param \Chill\CustomFieldsBundle\CustomField\FormBuilderInterface $builder + * @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField + * @return \Symfony\Component\Form\FormTypeInterface the form type + */ + public function buildForm(FormBuilderInterface $builder, CustomField $customField); + + /** + * transform the value into a format that can be stored in DB + * + * @param mixed $value + * @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField + */ + public function serialize($value, CustomField $customField); + + /** + * Transform the representation of the value, stored in db, into the + * value which may be used in the process. + * + * @param mixed $value + * @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField + */ + public function deserialize($serialized, CustomField $customField); + + /** + * + * @param type $value + * @param \Chill\CustomFieldsBundle\CustomField\CustomField $customField + */ + public function render($value, CustomField $customField); + + public function getName(); + + /** + * return a formType which allow to edit option for the custom type. + * This FormType is shown in admin + * + * @param \Chill\CustomFieldsBundle\CustomField\FormBuilderInterface $builder + * @return \Symfony\Component\Form\FormTypeInterface|null the form type + */ + public function buildOptionsForm(FormBuilderInterface $builder); +} diff --git a/CustomFields/CustomFieldText.php b/CustomFields/CustomFieldText.php new file mode 100644 index 000000000..3aab4a153 --- /dev/null +++ b/CustomFields/CustomFieldText.php @@ -0,0 +1,49 @@ + + */ +class CustomFieldText implements CustomFieldInterface +{ + public function buildForm(FormBuilderInterface $builder, CustomField $customField) + { + $builder->add($customField->getSlug(), 'text', array( + 'label' => $customField->getLabel() + )); + } + + public function render($value, CustomField $customField) + { + + } + + public function serialize($value, CustomField $customField) + { + return $value; + } + + public function deserialize($serialized, CustomField $customField) + { + return $serialized; + } + + public function getName() + { + return 'text field'; + } + + public function buildOptionsForm(FormBuilderInterface $builder) + { + return null; + } +} diff --git a/DependencyInjection/ChillCustomFieldsExtension.php b/DependencyInjection/ChillCustomFieldsExtension.php new file mode 100644 index 000000000..5d5eb4de5 --- /dev/null +++ b/DependencyInjection/ChillCustomFieldsExtension.php @@ -0,0 +1,36 @@ +processConfiguration($configuration, $configs); + + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yml'); + + //add at least a blank array at 'customizable_entities' options + //$customizable_entities = (isset($config['customizables_entities']) + // && $config['customizables_entities'] !== FALSE) + // ? $config['customizables_entities'] : array(); + + $container->setParameter('chill_custom_fields.customizables_entities', + $config['customizables_entities']); + } +} diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php new file mode 100644 index 000000000..472ce105a --- /dev/null +++ b/DependencyInjection/Configuration.php @@ -0,0 +1,43 @@ +root('chill_custom_fields'); + + $classInfo = "The class which may receive custom fields"; + $nameInfo = "The name which will appears in the user interface. May be translatable"; + $customizableEntitiesInfo = "A list of customizable entities"; + + $rootNode + ->children() + ->arrayNode('customizables_entities') + ->info($customizableEntitiesInfo) + ->defaultValue(array()) + ->prototype('array') + ->children() + ->scalarNode('class')->isRequired()->info($classInfo)->end() + ->scalarNode('name') ->isRequired()->info($nameInfo) ->end() + ->end() + ->end() + ->end() + ; + + return $treeBuilder; + } +} diff --git a/DependencyInjection/CustomFieldCompilerPass.php b/DependencyInjection/CustomFieldCompilerPass.php new file mode 100644 index 000000000..94eb4d9c3 --- /dev/null +++ b/DependencyInjection/CustomFieldCompilerPass.php @@ -0,0 +1,43 @@ + + */ +class CustomFieldCompilerPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if (!$container->hasDefinition('chill.custom_field_compiler')) { + throw new \LogicException('service chill.custom_field_compiler ' + . 'is not defined.'); + } + + $definition = $container->getDefinition( + 'chill.custom_field_compiler' + ); + + $taggedServices = $container->findTaggedServiceIds( + 'chill.custom_field' + ); + + foreach ($taggedServices as $id => $tagAttributes) { + foreach ($tagAttributes as $attributes) { + $definition->addMethodCall( + 'addCustomField', + array(new Reference($id), $attributes["type"]) + ); + } + } + } + +} diff --git a/Entity/Adress.php b/Entity/Adress.php new file mode 100644 index 000000000..a1fdc8457 --- /dev/null +++ b/Entity/Adress.php @@ -0,0 +1,59 @@ +data . '(id:' .$this->id .')'; + } + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set data + * + * @param string $data + * + * @return Adress + */ + public function setData($data) + { + $this->data = $data; + + return $this; + } + + /** + * Get data + * + * @return string + */ + public function getData() + { + return $this->data; + } +} diff --git a/Entity/BlopEntity.php b/Entity/BlopEntity.php new file mode 100644 index 000000000..b321559a1 --- /dev/null +++ b/Entity/BlopEntity.php @@ -0,0 +1,161 @@ +id; + } + + public function setAdress($a) + { + $this->adress = $a; + + return $this; + } + + /** + * Get field1 + * + * @return string + */ + public function getAdress() + { + return $this->adress; + } + + /** + * Set field1 + * + * @param string $field1 + * + * @return BlopEntity + */ + public function setField1($field1) + { + $this->field1 = $field1; + + return $this; + } + + /** + * Get field1 + * + * @return string + */ + public function getField1() + { + return $this->field1; + } + + /** + * Set field2 + * + * @param string $field2 + * + * @return BlopEntity + */ + public function setField2($field2) + { + $this->field2 = $field2; + + return $this; + } + + /** + * Get field2 + * + * @return string + */ + public function getField2() + { + return $this->field2; + } + + /** + * Set customField + * + * @param array $customField + * + * @return BlopEntity + */ + public function setCustomField(array $customField) + { + $this->customField = $customField; + + return $this; + } + + /** + * Get customField + * + * @return array + */ + public function getCustomField() + { + + return $this->customField; + } + + public function cfGet($key) + { + echo "
-1-
"; + echo gettype($this->customField); + echo "
-2-
"; + echo $this->customField; + echo "
-3-
"; + var_dump(json_decode($this->customField)); + echo "
-4-
"; + echo json_last_error_msg(); + + $customFieldArray = json_decode($this->customField, true); + + if(array_key_exists($key, $customFieldArray)) { + return $customFieldArray[$key]; + } else { + return null; + } + } + + public function cfSet($key, $value) + { + echo "-"; + $customFieldArray = json_decode($this->customField, true); + $customFieldArray[$key] = $value; + $this->setCustomField(json_encode($customFieldArray)); + var_dump($customFieldArray); + } +} diff --git a/Entity/BlopEntity2.php b/Entity/BlopEntity2.php new file mode 100644 index 000000000..60b4682ad --- /dev/null +++ b/Entity/BlopEntity2.php @@ -0,0 +1,247 @@ + obj dans des choses qui existent deja +// preFlush avant mise a jour de la db +// - met a jour les donnees liees au json et le json +// perPersist idem mais pour le persist + +/** + * BlopEntity2 + */ +class BlopEntity2 +{ + /** + * @var integer + */ + private $id; + + /** + * @var array + */ + private $customFieldData; + private $customFieldDataArray = array(); // customField apres json_decode + private $customFieldDataUnfolded = array(); // mise des entity de customFieldDataArray + + private $customFieldConfigs = array(); + + private $customFieldConfigsLoaded = false; + + // CHARGE DE LA DB LA CONFIG DES CUSTOM FIELDS + public function loadCustomFieldConfig(LifecycleEventArgs $args) + { + $em = $args->getObjectManager(); + + $customFields = $em + ->getRepository('ChillCustomFieldsBundle:CustomField') + ->findAll(); + + $customFieldsLablels = array_map( + function($e) { return $e->getLabel(); }, + $customFields); + + $this->customFieldConfigs = array_combine($customFieldsLablels, $customFields); + $this->customFieldConfigsLoaded = true; + } + + // A PARTIR DU JSON CREE LES OBJETS (MIS DANS customFieldDataUnfolded) + public function unfoldCustomFieldData(LifecycleEventArgs $args) + { + $em = $args->getObjectManager(); + + $customFieldDataArray = json_decode($this->customFieldData,true); + $customFieldDataUnfolded = array(); + + foreach ($this->customFieldConfigs as $key => $cfConfig) { + $type = $cfConfig->getType(); + if(strpos($type,'ManyToMany') === 0) { + $fieldUnfolded = new ArrayCollection(); + + if(array_key_exists($key, $customFieldDataArray)) { + $entityClass = substr($type, 11, -1); + + foreach ($customFieldDataArray[$key] as $idEntity) { + $fieldUnfolded->add($em + ->getRepository('ChillCustomFieldsBundle:' . $entityClass) + ->findOneById($idEntity)); + } + } + + $customFieldDataUnfolded[$key] = $fieldUnfolded; + } else if(strpos($type,'ManyToOne') === 0) { + $entityClass = 'Adress'; // substr($type,10,-1); + if(array_key_exists($key, $customFieldDataArray)) { + $customFieldDataUnfolded[$key] = $em + ->getRepository('ChillCustomFieldsBundle:' . $entityClass) + ->findOneById($customFieldDataArray[$key]); + } else { + // TODO : doit tjs avoir un id + $em + ->getRepository('ChillCustomFieldsBundle:' . $entityClass) + ->findOneById(1); + } + } + else if ($type === 'text') { + if(array_key_exists($key, $customFieldDataArray)) { + $customFieldDataUnfolded[$key] = $customFieldDataArray[$key]; + } else { + $customFieldDataUnfolded[$key] = ''; + } + } + } + + $this->customFieldDataUnfolded = $customFieldDataUnfolded; + } + + // AVANT PERSIST LES ELEMENTS QUI N'ONT PAS D'ID DOIVENT EN AVOIR UN (OM->PERSIST(OBJ)) + // PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS + // LE JSON (SE TROUVANT DANS customFieldData) + public function prePersist(LifecycleEventArgs $args) + { + $em = $args->getObjectManager(); + + $this->loadCustomFieldConfig($args); + + foreach ($this->customFieldDataUnfolded as $key => $unfoldedData) { + $type = $this->customFieldConfigs[$key]->getType(); + if(strpos($type,'ManyToMany') === 0) { + foreach ($this->customFieldDataUnfolded[$key] as $entity) { + if(! $entity->getId()) { + $em->persist($entity); + } + } + } else if(strpos($type,'ManyToOne') === 0) { + if(! $this->customFieldDataUnfolded[$key]->getId()) { + $em->persist($this->customFieldDataUnfolded[$key]); + } + } + } + + $this->customFieldDataUnfoldedToCustomField(); + } + + // PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS + // LE JSON (SE TROUVANT DANS customFieldData) + public function preFlush(PreFlushEventArgs $args) + { + $this->customFieldDataUnfoldedToCustomField(); + } + + // PUIS PASSAGE DES OBJETS (SE TROUVANT DANS customFieldDataUnfolded) VERS + // LE JSON (SE TROUVANT DANS customFieldData) + public function customFieldDataUnfoldedToCustomField() + { + // MISE A JOUR DE customFieldDataArray + foreach ($this->customFieldConfigs as $key => $cfConfig) { + $type = $cfConfig->getType(); + if(strpos($type,'ManyToMany') === 0) { + $arrayMapRet = array(); + foreach ($this->customFieldDataUnfolded[$key] as $entity) { + $arrayMapRet[] = $entity->getId(); + } + $this->customFieldDataArray[$key] = $arrayMapRet; // array_map(function($e) { $e->getId(); }, $this->customFieldDataUnfolded[$key]); + } else if(strpos($type,'ManyToOne') === 0) { + if(array_key_exists($key, $this->customFieldDataUnfolded)) { + $this->customFieldDataArray[$key] = $this->customFieldDataUnfolded[$key]->getId(); + } else { + // normalement $this->customFieldDataArray[$key] ne doit pas exister + if(array_key_exists($key, $this->customFieldDataArray)) { + throw new Exception("Error Processing Request", 1); + } + //retirer de $this->customFieldDataArray[$key] + } + } else if ($type === 'text') { + $this->customFieldDataArray[$key] = $this->customFieldDataUnfolded[$key]; + } + } + + // MISE A JOUR DE CustomFieldData + $this->setCustomFieldData(json_encode($this->customFieldDataArray)); + } + + public function __set($fieldName, $value) { + $setMethodName = 'set' . ucfirst($fieldName); + + if(method_exists($this, $setMethodName)) { + return $this->{$setMethodName}($value); + } + + if(array_key_exists($fieldName, $this->customFieldConfigs)) { + $this->customFieldDataUnfolded[$fieldName] = $value; + } else if (!$this->customFieldConfigsLoaded) { // nouvel object pas eu d'appel doctrine avant + $this->customFieldDataUnfolded[$fieldName] = $value; + } else { + throw new Exception("Error Processing Request", 1); + } + } + + public function __get($fieldName) { + $getMethodName = 'get' . ucfirst($fieldName); + + if(method_exists($this, $getMethodName)) { + return $this->{$getMethodName}(); + } + + if(array_key_exists($fieldName, $this->customFieldDataUnfolded)) { + return $this->customFieldDataUnfolded[$fieldName]; + } else if (!$this->customFieldConfigsLoaded) { // nouvel object pas eu d'appel doctrine avant + return null; + } else if(array_key_exists($fieldName, $this->customFieldConfigs)) { // pas init + return null; + } else { + throw new Exception("Error Processing Request", 1); + } + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set customField + * + * @param array $customField + * + * @return BlopEntity2 + */ + public function setCustomFieldData($customFieldData) + { + $this->customFieldData = $customFieldData; + return $this; + } + + /** + * Get customField + * + * @return array + */ + public function getCustomFieldData() + { + return $this->customFieldData; + } +} diff --git a/Entity/CustomField.php b/Entity/CustomField.php new file mode 100644 index 000000000..052b2f8a2 --- /dev/null +++ b/Entity/CustomField.php @@ -0,0 +1,280 @@ +id; + } + + function getSlug() + { + return $this->slug; + } + + /** + * Set label + * + * @param string $label + * + * @return CustomField + */ + public function setLabel($label) + { + $this->label = $label; + + if ($this->slug === NULL) { + $this->slug = preg_replace('/[^A-Za-z0-9-]+/', '-', $label); + } + + return $this; + } + + function getOptions() + { + return $this->options; + } + + /** + * Get label + * + * @return string + */ + public function getLabel() + { + return $this->label; + } + + /** + * Set type + * + * @param string $type + * + * @return CustomField + */ + public function setType($type) + { + $this->type = $type; + + return $this; + } + + /** + * Get type + * + * @return string + */ + public function getType() + { + return $this->type; + } + + function getRelation() + { + return $this->relation; + } + + function setRelation($relation) + { + $this->relation = $relation; + + return $this; + } + + + /** + * Set active + * + * @param boolean $active + * + * @return CustomField + */ + public function setActive($active) + { + $this->active = $active; + + return $this; + } + + /** + * Get active + * + * @return boolean + */ + public function getActive() + { + return $this->active; + } + + /** + * Get customFieldGroup + * + * @return CustomFieldsGroup + */ + public function getCustomFieldsGroup() + { + return $this->customFieldGroup; + } + + /** + * Set customFieldGroup + * + * @param \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup + * + * @return CustomField + */ + public function setCustomFieldsGroup(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null) + { + $this->customFieldGroup = $customFieldGroup; + + return $this; + } + + /** + * Set name + * + * @param array $name + * + * @return CustomField + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return array + */ + public function getName() + { + return $this->name; + } + + /** + * Set order + * + * @param float $order + * + * @return CustomField + */ + public function setOrdering($order) + { + $this->ordering = $order; + + return $this; + } + + /** + * Get order + * + * @return float + */ + public function getOrdering() + { + return $this->ordering; + } + + /** + * Set options + * + * @param array $options + * + * @return CustomField + */ + public function setOptions(array $options) + { + $this->options = $options; + + return $this; + } + + /** + * Set customFieldGroup + * + * @param \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup + * + * @return CustomField + */ + public function setCustomFieldGroup(\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup $customFieldGroup = null) + { + $this->customFieldGroup = $customFieldGroup; + + return $this; + } + + /** + * Get customFieldGroup + * + * @return \Chill\CustomFieldsBundle\Entity\CustomFieldsGroup + */ + public function getCustomFieldGroup() + { + return $this->customFieldGroup; + } +} diff --git a/Entity/CustomFieldsGroup.php b/Entity/CustomFieldsGroup.php new file mode 100644 index 000000000..fe09a25ea --- /dev/null +++ b/Entity/CustomFieldsGroup.php @@ -0,0 +1,146 @@ +customFields = new \Doctrine\Common\Collections\ArrayCollection(); + } + + /** + * Add customField + * + * @param \Chill\CustomFieldsBundle\Entity\CustomField $customField + * + * @return CustomFieldsGroup + */ + public function addCustomField(\Chill\CustomFieldsBundle\Entity\CustomField $customField) + { + $this->customFields[] = $customField; + + return $this; + } + + /** + * Remove customField + * + * @param \Chill\CustomFieldsBundle\Entity\CustomField $customField + */ + public function removeCustomField(\Chill\CustomFieldsBundle\Entity\CustomField $customField) + { + $this->customFields->removeElement($customField); + } + + /** + * + * @return \Doctrine\Common\Collections\Collection + */ + public function getCustomFields() + { + return $this->customFields; + } + + + /** + * Get id + * + * @return integer + */ + public function getId() + { + return $this->id; + } + + /** + * Set name + * + * @param array $name + * + * @return CustomFieldsGroup + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return array + */ + public function getName($language = null) + { + //TODO set this in a service, PLUS twig function + if ($language) { + if (isset($this->name[$language])) { + return $this->name[$language]; + } else { + foreach ($this->name as $name) { + if (!empty($name)) { + return $name; + } + } + } + + return ''; + + } else { + return $this->name; + } + } + + /** + * Set entity + * + * @param string $entity + * + * @return CustomFieldsGroup + */ + public function setEntity($entity) + { + $this->entity = $entity; + + return $this; + } + + /** + * Get entity + * + * @return string + */ + public function getEntity() + { + return $this->entity; + } + +} diff --git a/Form/AdressType.php b/Form/AdressType.php new file mode 100644 index 000000000..677e7acd6 --- /dev/null +++ b/Form/AdressType.php @@ -0,0 +1,52 @@ +add('data', 'entity', array( + + )) + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { +// $resolver->setDefaults(array( +// 'data_class' => 'Chill\CustomFieldsBundle\Entity\Adress', +// 'class' => 'Chill\CustomFieldsBundle\Entity\Adress' +// )); + } + + public function getParent() + { + return 'entity'; + } + + /** + * @return string + */ + public function getName() + { + return 'adress'; + } +} diff --git a/Form/BlopEntity2Type.php b/Form/BlopEntity2Type.php new file mode 100644 index 000000000..e885bcf81 --- /dev/null +++ b/Form/BlopEntity2Type.php @@ -0,0 +1,69 @@ +getRepository('ChillCustomFieldsBundle:CustomField') + ->findAll(); + + foreach ($customFields as $cf) { + if($cf->getType() === 'ManyToOne(Adress)') { + $builder->add($cf->getLabel(), 'entity', array( + 'class' => 'ChillCustomFieldsBundle:Adress', + 'property' => 'data' + )); + } else if ($cf->getType() === 'ManyToOnePersist(Adress)') { + $builder->add($cf->getLabel(), new AdressType()); + } else if($cf->getType() === 'ManyToMany(Adress)') { + $builder->add($cf->getLabel(), 'entity', array( + 'class' => 'ChillCustomFieldsBundle:Adress', + 'property' => 'data', + 'multiple' => true + )); + } else if ($cf->getType() === 'text') { + $builder->add($cf->getLabel(), 'text'); + } + } + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity2' + )); + + // supprimer ça en definissant dans services + $resolver->setRequired(array( + 'em', + )); + + $resolver->setAllowedTypes(array( + 'em' => 'Doctrine\Common\Persistence\ObjectManager', + )); + } + + /** + * @return string + */ + public function getName() + { + return 'cl_customfieldsbundle_blopentity2'; + } +} diff --git a/Form/BlopEntityType.php b/Form/BlopEntityType.php new file mode 100644 index 000000000..fdbf26dd1 --- /dev/null +++ b/Form/BlopEntityType.php @@ -0,0 +1,56 @@ +add('field1') + ->add('field2') + //->add('adress', new AdressType()) + ->add('customField', 'custom_field') + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\CustomFieldsBundle\Entity\BlopEntity', + 'cascade_validation' => true + )); + + // supprimer ça en definissant dans services + $resolver->setRequired(array( + 'em', + )); + + $resolver->setAllowedTypes(array( + 'em' => 'Doctrine\Common\Persistence\ObjectManager', + )); + + } + + /** + * @return string + */ + public function getName() + { + return 'cl_customfieldsbundle_blopentity'; + } +} diff --git a/Form/CustomFieldType.php b/Form/CustomFieldType.php new file mode 100644 index 000000000..9137977ef --- /dev/null +++ b/Form/CustomFieldType.php @@ -0,0 +1,80 @@ +customFieldProvider = $compiler; + } + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + + $customFieldsList = array(); + + foreach ($this->customFieldProvider->getAllFields() as $key => $field) { + $customFieldsList[$key] = $field->getName(); + } + + $builder + ->add('name', 'text') + ->add('active') + ->add('customFieldsGroup', 'entity', array( + 'class' => 'ChillCustomFieldsBundle:CustomFieldsGroup', + 'property' => 'name['.$this->culture.']' + )) + ->add('ordering', 'number') + ; + + //add options field + $optionsType = $this->customFieldProvider + ->getCustomFieldByType($options['type']) + ->buildOptionsForm($builder); + if ($optionsType) { + $builder->add('options', $optionsType); + } + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\CustomFieldsBundle\Entity\CustomField' + )); + + $resolver->setRequired(array('type')) + ->addAllowedValues(array('type' => + array_keys($this->customFieldProvider->getAllFields()) + )); + } + + /** + * @return string + */ + public function getName() + { + return 'custom_field_choice'; + } +} diff --git a/Form/CustomFieldsGroupType.php b/Form/CustomFieldsGroupType.php new file mode 100644 index 000000000..1dd35a16e --- /dev/null +++ b/Form/CustomFieldsGroupType.php @@ -0,0 +1,66 @@ +customizableEntities = $customizableEntities; + $this->translator = $translator; + } + + /** + * @param FormBuilderInterface $builder + * @param array $options + */ + public function buildForm(FormBuilderInterface $builder, array $options) + { + //prepare translation + $customizableEntites = array(); + + foreach($this->customizableEntities as $key => $definition) { + $customizableEntites[$definition['class']] = $this->translator->trans($definition['name']); + } + + $builder + ->add('name') + ->add('entity', 'choice', array( + 'choices' => $customizableEntites + )) + ; + } + + /** + * @param OptionsResolverInterface $resolver + */ + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'data_class' => 'Chill\CustomFieldsBundle\Entity\CustomFieldsGroup' + )); + } + + /** + * @return string + */ + public function getName() + { + return 'custom_fields_group'; + } +} diff --git a/Form/DataTransformer/CustomFieldDataTransformer.php b/Form/DataTransformer/CustomFieldDataTransformer.php new file mode 100644 index 000000000..f54c8b818 --- /dev/null +++ b/Form/DataTransformer/CustomFieldDataTransformer.php @@ -0,0 +1,43 @@ + + */ +class CustomFieldDataTransformer implements DataTransformerInterface +{ + private $customFieldDefinition; + + /** + * + * @var \Chill\CustomFieldsBundle\Entity\CustomField + */ + private $customField; + + public function __construct(CustomFieldInterface $customFieldDefinition, + CustomField $customField) + { + $this->customFieldDefinition = $customFieldDefinition; + $this->customField = $customField; + } + + public function reverseTransform($value) + { + return $this->customFieldDefinition->serialize($value, + $this->customField); + } + + public function transform($value) + { + return $this->customFieldDefinition->deserialize($value, + $this->customField); + } + +} diff --git a/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php b/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php new file mode 100644 index 000000000..b3865a310 --- /dev/null +++ b/Form/DataTransformer/JsonCustomFieldToArrayTransformer.php @@ -0,0 +1,145 @@ +om = $om; + + $customFields = $this->om + ->getRepository('ChillCustomFieldsBundle:CustomField') + ->findAll(); + + $customFieldsLablels = array_map( + function($e) { return $e->getLabel(); }, + $customFields); + + $customFieldsByLabel = array_combine($customFieldsLablels, $customFields); + + $this->customField = $customFieldsByLabel; + } + + public function transform($customFieldsJSON) + { + echo $customFieldsJSON; + + if($customFieldsJSON === null) { // lors de la creation + $customFieldsArray = array(); + } else { + $customFieldsArray = json_decode($customFieldsJSON,true); + } + + /* + echo "
- 4 -
"; + + var_dump($customFieldsArray); + + echo "
- 5 -
"; + */ + + $customFieldsArrayRet = array(); + + foreach ($customFieldsArray as $key => $value) { + $traited = false; + if(array_key_exists($key, $this->customField)) { + $type = $this->customField[$key]->getType(); + if(strpos($type,'ManyToOne') === 0) { + if(strpos($type,'ManyToOnePersist') ===0) { + $entityClass = substr($type, 17, -1); + } else { + $entityClass = substr($type, 10, -1); + } + + $customFieldsArrayRet[$key] = $this->om + ->getRepository('ChillCustomFieldsBundle:' . $entityClass) + ->findOneById($value); + $traited = true; + } else if ($type === 'ManyToMany(Adress)') { + $customFieldsArrayRet[$key] = $value; + } + } + + if(! $traited) { + $customFieldsArrayRet[$key] = $value; + } + } + + var_dump($customFieldsArrayRet); + + return $customFieldsArrayRet; + } + + public function reverseTransform($customFieldsArray) + { + /* + echo "
- - 7 -
"; + + + var_dump(array_keys($customFieldsArray)); + + echo "
- - 8 -
"; + + var_dump(array_keys($this->customField)); + + echo "
- - 9 -
"; + */ + + //var_dump($customFieldsArray); + + $customFieldsArrayRet = array(); + + foreach ($customFieldsArray as $key => $value) { + $traited = false; + if(array_key_exists($key, $this->customField)) { + $type = $this->customField[$key]->getType(); + if(strpos($type,'ManyToOne') === 0) { + // pour le manytoone() faire + // un update du form en js ? : http://symfony.com/fr/doc/current/cookbook/form/form_collections.html + // + //$entityClass = substr($type, 10, -1); + //echo $entityClasss; + if(strpos($type, 'ManyToOnePersist') === 0) { + // PEUT ETRE A FAIRE SI SEULEMENT $value->getId() ne renvoie rien... + // + // + $this->om->persist($value); // pas bon ici + // LE PERSIST NE SERT QUE LA PREMIERE FOIS + // plutot le mettre dans une var temporaire de adress + // et faire le persist qd fait sur l'obj parent + // regarder : http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html + // ou : http://symfony.com/doc/current/cookbook/doctrine/event_listeners_subscribers.html + // dans yml : + // lifecycleCallbacks: + // prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersist ] + $this->om->flush(); // sinon l'id pose pbm + } + + $customFieldsArrayRet[$key] = $value->getId(); + $traited = true; + } + } + + if(! $traited) { + $customFieldsArrayRet[$key] = $value; + } + + } + + //echo json_encode($customFieldsArrayRet); + + return json_encode($customFieldsArrayRet); + } +} \ No newline at end of file diff --git a/Form/Type/CustomFieldType.php b/Form/Type/CustomFieldType.php new file mode 100644 index 000000000..7f6262bd6 --- /dev/null +++ b/Form/Type/CustomFieldType.php @@ -0,0 +1,117 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Chill\CustomFieldsBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilderInterface; +use Chill\CustomFieldsBundle\Form\DataTransformer\JsonCustomFieldToArrayTransformer; +use Doctrine\Common\Persistence\ObjectManager; +use Chill\CustomFieldsBundle\Form\AdressType; +use Chill\CustomFieldsBundle\Service\CustomFieldProvider; +use Chill\CustomFieldsBundle\Form\DataTransformer\CustomFieldDataTransformer; + +class CustomFieldType extends AbstractType +{ + + /** + * @var ObjectManager + */ + private $om; + + /** + * + * @var CustomFieldCompiler + */ + private $customFieldCompiler; + + /** + * @param ObjectManager $om + */ + public function __construct(ObjectManager $om, CustomFieldProvider $compiler) + { + $this->om = $om; + $this->customFieldCompiler = $compiler; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $customFields = $this->om + ->getRepository('ChillCustomFieldsBundle:CustomField') + ->findAll(); + + foreach ($customFields as $cf) { + + //$builder->add( + //$builder->create( + //$cf->getSlug(), + $this->customFieldCompiler + ->getCustomFieldByType($cf->getType()) + ->buildForm($builder, $cf); + /* ) + ->addModelTransformer(new CustomFieldDataTransformer( + $this->customFieldCompiler + ->getCustomFieldByType($cf->getType()), + $cf) + )*/ + //); + +// if($cf->getType() === 'ManyToOne(Adress)') { +// $builder->add($cf->getLabel(), 'entity', array( +// 'class' => 'ChillCustomFieldsBundle:Adress', +// 'property' => 'data' +// )); +// } else if ($cf->getType() === 'ManyToOnePersist(Adress)') { +// $builder->add($cf->getLabel(), new AdressType()); +// } else if($cf->getType() === 'ManyToMany(Adress)') { +// +// $adress = $this->om +// ->getRepository('ChillCustomFieldsBundle:Adress') +// ->findAll(); +// +// $adressId = array_map( +// function($e) { return $e->getId(); }, +// $adress); +// +// $adressLabel = array_map( +// function($e) { return (string) $e; }, +// $adress); +// +// $addressChoices = array_combine($adressId, $adressLabel); +// +// +// $builder->add($cf->getLabel(), 'choice', array( +// 'choices' => $addressChoices, +// 'multiple' => true +// )); +// } +// else { +// $builder->add($cf->getLabel(), $cf->getType()); +// } + } + + //$builder->addViewTransformer(new JsonCustomFieldToArrayTransformer($this->om)); + } + + public function setDefaultOptions(\Symfony\Component\OptionsResolver\OptionsResolverInterface $resolver) + { + $resolver + //->addAllowedTypes(array('context' => 'string')) + //->setRequired(array('context')) + ; + } + + public function getName() + { + return 'custom_field'; + } + +} \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index ac829b520..000000000 --- a/README.md +++ /dev/null @@ -1,170 +0,0 @@ -Symfony Standard Edition -======================== - -Welcome to the Symfony Standard Edition - a fully-functional Symfony2 -application that you can use as the skeleton for your new applications. - -This document contains information on how to download, install, and start -using Symfony. For a more detailed explanation, see the [Installation][1] -chapter of the Symfony Documentation. - -1) Installing the Standard Edition ----------------------------------- - -When it comes to installing the Symfony Standard Edition, you have the -following options. - -### Use Composer (*recommended*) - -As Symfony uses [Composer][2] to manage its dependencies, the recommended way -to create a new project is to use it. - -If you don't have Composer yet, download it following the instructions on -http://getcomposer.org/ or just run the following command: - - curl -s http://getcomposer.org/installer | php - -Then, use the `create-project` command to generate a new Symfony application: - - php composer.phar create-project symfony/framework-standard-edition path/to/install - -Composer will install Symfony and all its dependencies under the -`path/to/install` directory. - -### Download an Archive File - -To quickly test Symfony, you can also download an [archive][3] of the Standard -Edition and unpack it somewhere under your web server root directory. - -If you downloaded an archive "without vendors", you also need to install all -the necessary dependencies. Download composer (see above) and run the -following command: - - php composer.phar install - -2) Checking your System Configuration -------------------------------------- - -Before starting coding, make sure that your local system is properly -configured for Symfony. - -Execute the `check.php` script from the command line: - - php app/check.php - -The script returns a status code of `0` if all mandatory requirements are met, -`1` otherwise. - -Access the `config.php` script from a browser: - - http://localhost/path-to-project/web/config.php - -If you get any warnings or recommendations, fix them before moving on. - -3) Browsing the Demo Application --------------------------------- - -Congratulations! You're now ready to use Symfony. - -From the `config.php` page, click the "Bypass configuration and go to the -Welcome page" link to load up your first Symfony page. - -You can also use a web-based configurator by clicking on the "Configure your -Symfony Application online" link of the `config.php` page. - -To see a real-live Symfony page in action, access the following page: - - web/app_dev.php/demo/hello/Fabien - -4) Getting started with Symfony -------------------------------- - -This distribution is meant to be the starting point for your Symfony -applications, but it also contains some sample code that you can learn from -and play with. - -A great way to start learning Symfony is via the [Quick Tour][4], which will -take you through all the basic features of Symfony2. - -Once you're feeling good, you can move onto reading the official -[Symfony2 book][5]. - -A default bundle, `AcmeDemoBundle`, shows you Symfony2 in action. After -playing with it, you can remove it by following these steps: - - * delete the `src/Acme` directory; - - * remove the routing entry referencing AcmeDemoBundle in `app/config/routing_dev.yml`; - - * remove the AcmeDemoBundle from the registered bundles in `app/AppKernel.php`; - - * remove the `web/bundles/acmedemo` directory; - - * empty the `security.yml` file or tweak the security configuration to fit - your needs. - -What's inside? ---------------- - -The Symfony Standard Edition is configured with the following defaults: - - * Twig is the only configured template engine; - - * Doctrine ORM/DBAL is configured; - - * Swiftmailer is configured; - - * Annotations for everything are enabled. - -It comes pre-configured with the following bundles: - - * **FrameworkBundle** - The core Symfony framework bundle - - * [**SensioFrameworkExtraBundle**][6] - Adds several enhancements, including - template and routing annotation capability - - * [**DoctrineBundle**][7] - Adds support for the Doctrine ORM - - * [**TwigBundle**][8] - Adds support for the Twig templating engine - - * [**SecurityBundle**][9] - Adds security by integrating Symfony's security - component - - * [**SwiftmailerBundle**][10] - Adds support for Swiftmailer, a library for - sending emails - - * [**MonologBundle**][11] - Adds support for Monolog, a logging library - - * [**AsseticBundle**][12] - Adds support for Assetic, an asset processing - library - - * **WebProfilerBundle** (in dev/test env) - Adds profiling functionality and - the web debug toolbar - - * **SensioDistributionBundle** (in dev/test env) - Adds functionality for - configuring and working with Symfony distributions - - * [**SensioGeneratorBundle**][13] (in dev/test env) - Adds code generation - capabilities - - * **AcmeDemoBundle** (in dev/test env) - A demo bundle with some example - code - -All libraries and bundles included in the Symfony Standard Edition are -released under the MIT or BSD license. - -Enjoy! - -[1]: http://symfony.com/doc/2.4/book/installation.html -[2]: http://getcomposer.org/ -[3]: http://symfony.com/download -[4]: http://symfony.com/doc/2.4/quick_tour/the_big_picture.html -[5]: http://symfony.com/doc/2.4/index.html -[6]: http://symfony.com/doc/2.4/bundles/SensioFrameworkExtraBundle/index.html -[7]: http://symfony.com/doc/2.4/book/doctrine.html -[8]: http://symfony.com/doc/2.4/book/templating.html -[9]: http://symfony.com/doc/2.4/book/security.html -[10]: http://symfony.com/doc/2.4/cookbook/email.html -[11]: http://symfony.com/doc/2.4/cookbook/logging/monolog.html -[12]: http://symfony.com/doc/2.4/cookbook/assetic/asset_management.html -[13]: http://symfony.com/doc/2.4/bundles/SensioGeneratorBundle/index.html diff --git a/Resources/config/doctrine/Adress.orm.yml b/Resources/config/doctrine/Adress.orm.yml new file mode 100644 index 000000000..ff23bdc27 --- /dev/null +++ b/Resources/config/doctrine/Adress.orm.yml @@ -0,0 +1,14 @@ +Chill\CustomFieldsBundle\Entity\Adress: + type: entity + table: null + id: + id: + type: integer + id: true + generator: + strategy: AUTO + fields: + data: + type: string + length: 255 + lifecycleCallbacks: { } diff --git a/Resources/config/doctrine/BlopEntity.orm.yml b/Resources/config/doctrine/BlopEntity.orm.yml new file mode 100644 index 000000000..e2a24f962 --- /dev/null +++ b/Resources/config/doctrine/BlopEntity.orm.yml @@ -0,0 +1,23 @@ +Chill\CustomFieldsBundle\Entity\BlopEntity: + type: entity + table: blop_entity + id: + id: + type: integer + id: true + generator: + strategy: AUTO + fields: + field1: + type: string + length: 255 + field2: + type: string + length: 255 + customField: + type: json_array + manyToOne: + adress: + targetEntity: Chill\CustomFieldsBundle\Entity\Adress + cascade: [persist] + lifecycleCallbacks: { } diff --git a/Resources/config/doctrine/BlopEntity2.orm.yml b/Resources/config/doctrine/BlopEntity2.orm.yml new file mode 100644 index 000000000..f05897041 --- /dev/null +++ b/Resources/config/doctrine/BlopEntity2.orm.yml @@ -0,0 +1,16 @@ +Chill\CustomFieldsBundle\Entity\BlopEntity2: + type: entity + table: null + id: + id: + type: integer + id: true + generator: + strategy: AUTO + fields: + customFieldData: + type: json_array + lifecycleCallbacks: + postLoad: [ loadCustomFieldConfig, unfoldCustomFieldData ] + preFlush: [ preFlush ] + prePersist: [ prePersist ] \ No newline at end of file diff --git a/Resources/config/doctrine/CustomField.orm.yml b/Resources/config/doctrine/CustomField.orm.yml new file mode 100644 index 000000000..595e96db5 --- /dev/null +++ b/Resources/config/doctrine/CustomField.orm.yml @@ -0,0 +1,30 @@ +Chill\CustomFieldsBundle\Entity\CustomField: + type: entity + table: null + id: + id: + type: integer + id: true + generator: + strategy: AUTO + fields: + name: + type: json_array + slug: + type: string + length: 255 + type: + type: string + length: 255 + active: + type: boolean + ordering: + type: float + options: + type: json_array + lifecycleCallbacks: { } + manyToOne: + customFieldGroup: + targetEntity: Chill\CustomFieldsBundle\Entity\CustomFieldsGroup + inversedBy: customFields +#TODO: add an unique constraint slug+customFieldsGroup \ No newline at end of file diff --git a/Resources/config/doctrine/CustomFieldsGroup.orm.yml b/Resources/config/doctrine/CustomFieldsGroup.orm.yml new file mode 100644 index 000000000..e6f47e614 --- /dev/null +++ b/Resources/config/doctrine/CustomFieldsGroup.orm.yml @@ -0,0 +1,19 @@ +Chill\CustomFieldsBundle\Entity\CustomFieldsGroup: + type: entity + table: null + id: + id: + type: integer + id: true + generator: + strategy: AUTO + fields: + name: + type: json_array + entity: + type: string + length: 255 + oneToMany: + customFields: + targetEntity: Chill\CustomFieldsBundle\Entity\CustomField + mappedBy: customFieldGroup \ No newline at end of file diff --git a/Resources/config/routing.yml b/Resources/config/routing.yml new file mode 100644 index 000000000..b12886590 --- /dev/null +++ b/Resources/config/routing.yml @@ -0,0 +1,20 @@ +cl_custom_fields_customfieldsgroup: + resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfieldsgroup.yml" + prefix: /customfieldsgroup + +cl_custom_fields_blopentity2: + resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity2.yml" + prefix: /blopentity2 + +cl_custom_fields_adress: + resource: "@ChillCustomFieldsBundle/Resources/config/routing/adress.yml" + prefix: /adress + +cl_custom_fields_customfield: + resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfield.yml" + prefix: /customfield + +cl_custom_fields_blopentity: + resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity.yml" + prefix: / + diff --git a/Resources/config/routing/adress.yml b/Resources/config/routing/adress.yml new file mode 100644 index 000000000..667f87b6c --- /dev/null +++ b/Resources/config/routing/adress.yml @@ -0,0 +1,30 @@ +adress: + path: / + defaults: { _controller: "ChillCustomFieldsBundle:Adress:index" } + +adress_show: + path: /{id}/show + defaults: { _controller: "ChillCustomFieldsBundle:Adress:show" } + +adress_new: + path: /new + defaults: { _controller: "ChillCustomFieldsBundle:Adress:new" } + +adress_create: + path: /create + defaults: { _controller: "ChillCustomFieldsBundle:Adress:create" } + requirements: { _method: post } + +adress_edit: + path: /{id}/edit + defaults: { _controller: "ChillCustomFieldsBundle:Adress:edit" } + +adress_update: + path: /{id}/update + defaults: { _controller: "ChillCustomFieldsBundle:Adress:update" } + requirements: { _method: post|put } + +adress_delete: + path: /{id}/delete + defaults: { _controller: "ChillCustomFieldsBundle:Adress:delete" } + requirements: { _method: post|delete } diff --git a/Resources/config/routing/blopentity.yml b/Resources/config/routing/blopentity.yml new file mode 100644 index 000000000..78ff9b0f8 --- /dev/null +++ b/Resources/config/routing/blopentity.yml @@ -0,0 +1,42 @@ +blopentity: + path: / + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:index" } + +blopentity_show: + path: /{id}/show + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:show" } + +blopentity_new: + path: /new + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:new" } + +blopentity_create: + path: /create + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:create" } + requirements: { _method: post } + +blopentity_edit: + path: /{id}/edit + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:edit" } + +blopentity_update: + path: /{id}/update + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:update" } + requirements: { _method: post|put } + +blopentity_delete: + path: /{id}/delete + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:delete" } + requirements: { _method: post|delete } + +blopentity_cfget: + path: /{id}/cfget/{key} + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:cfGet" } + +blopentity_cfset: + path: /{id}/cfset/{key}/{value} + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity:cfSet" } + +blopentity_addmany_to_one: + path: /{id}/add/custom/field/{key} + defaults: {_controller: "ChillCustomFieldsBundle:BlopEntity:addNewManyToOne"} \ No newline at end of file diff --git a/Resources/config/routing/blopentity2.yml b/Resources/config/routing/blopentity2.yml new file mode 100644 index 000000000..9ca2c0de2 --- /dev/null +++ b/Resources/config/routing/blopentity2.yml @@ -0,0 +1,30 @@ +blopentity2: + path: / + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:index" } + +blopentity2_show: + path: /{id}/show + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:show" } + +blopentity2_new: + path: /new + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:new" } + +blopentity2_create: + path: /create + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:create" } + requirements: { _method: post } + +blopentity2_edit: + path: /{id}/edit + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:edit" } + +blopentity2_update: + path: /{id}/update + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:update" } + requirements: { _method: post|put } + +blopentity2_delete: + path: /{id}/delete + defaults: { _controller: "ChillCustomFieldsBundle:BlopEntity2:delete" } + requirements: { _method: post|delete } diff --git a/Resources/config/routing/customfield.yml b/Resources/config/routing/customfield.yml new file mode 100644 index 000000000..171b38c6b --- /dev/null +++ b/Resources/config/routing/customfield.yml @@ -0,0 +1,30 @@ +customfield: + path: / + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:index" } + +customfield_show: + path: /{id}/show + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:show" } + +customfield_new: + path: /new + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:new" } + +customfield_create: + path: /create + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:create" } + requirements: { _method: post } + +customfield_edit: + path: /{id}/edit + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:edit" } + +customfield_update: + path: /{id}/update + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:update" } + requirements: { _method: post|put } + +customfield_delete: + path: /{id}/delete + defaults: { _controller: "ChillCustomFieldsBundle:CustomField:delete" } + requirements: { _method: post|delete } diff --git a/Resources/config/routing/customfieldsgroup.yml b/Resources/config/routing/customfieldsgroup.yml new file mode 100644 index 000000000..6d12e2e53 --- /dev/null +++ b/Resources/config/routing/customfieldsgroup.yml @@ -0,0 +1,30 @@ +customfieldsgroup: + path: / + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:index" } + +customfieldsgroup_show: + path: /{id}/show + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:show" } + +customfieldsgroup_new: + path: /new + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:new" } + +customfieldsgroup_create: + path: /create + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:create" } + requirements: { _method: post } + +customfieldsgroup_edit: + path: /{id}/edit + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:edit" } + +customfieldsgroup_update: + path: /{id}/update + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:update" } + requirements: { _method: post|put } + +customfieldsgroup_delete: + path: /{id}/delete + defaults: { _controller: "ChillCustomFieldsBundle:CustomFieldsGroup:delete" } + requirements: { _method: post|delete } diff --git a/Resources/config/services.yml b/Resources/config/services.yml new file mode 100644 index 000000000..78ecea642 --- /dev/null +++ b/Resources/config/services.yml @@ -0,0 +1,44 @@ +parameters: +# cl_custom_fields.example.class: Chill\CustomFieldsBundle\Example + +services: + chill.custom_field_compiler: + class: Chill\CustomFieldsBundle\Service\CustomFieldProvider + call: + - [setContainer, ["@service_container"]] + + chill.custom_field.custom_field_choice_type: + class: Chill\CustomFieldsBundle\Form\CustomFieldType + arguments: + - "@chill.custom_field_compiler" + + tags: + - { name: 'form.type', alias: 'custom_field_choice' } + + chill.custom_field.custom_fields_group_type: + class: Chill\CustomFieldsBundle\Form\CustomFieldsGroupType + arguments: + - %chill_custom_fields.customizables_entities% + - "@translator" + tags: + - { name: 'form.type', alias: 'custom_fields_group' } + + chill.custom_field.custom_field_type: + class: Chill\CustomFieldsBundle\Form\Type\CustomFieldType + arguments: + - "@doctrine.orm.entity_manager" + - "@chill.custom_field_compiler" + tags: + - { name: 'form.type', alias: 'custom_field' } + + chill.custom_field.text: + class: Chill\CustomFieldsBundle\CustomFields\CustomFieldText + tags: + - { name: 'chill.custom_field', type: 'text' } + + chill.custom_field.address: + class: Chill\CustomFieldsBundle\CustomFields\CustomFieldAddress + arguments: + - "@doctrine.orm.entity_manager" + tags: + - { name: 'chill.custom_field', type: 'address' } diff --git a/Resources/views/Adress/edit.html.twig b/Resources/views/Adress/edit.html.twig new file mode 100644 index 000000000..16495743b --- /dev/null +++ b/Resources/views/Adress/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Adress edit

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

Adress list

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

Adress creation

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

Adress

+ + + + + + + + + + + + +
Id{{ entity.id }}
Data{{ entity.data }}
+ + +{% endblock %} diff --git a/Resources/views/BlopEntity/edit.html.twig b/Resources/views/BlopEntity/edit.html.twig new file mode 100644 index 000000000..6ce9b1cb5 --- /dev/null +++ b/Resources/views/BlopEntity/edit.html.twig @@ -0,0 +1,22 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

BlopEntity edit

+ + {{ form_start(edit_form) }} + + {{ form_row(edit_form.customField) }} + + {{ form_rest(edit_form) }} + + {{ form_end(edit_form) }} + + +{% endblock %} diff --git a/Resources/views/BlopEntity/index.html.twig b/Resources/views/BlopEntity/index.html.twig new file mode 100644 index 000000000..2f80f71a5 --- /dev/null +++ b/Resources/views/BlopEntity/index.html.twig @@ -0,0 +1,45 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

BlopEntity list

+ + + + + + + + + + + + + {% for entity in entities %} + + + + + + + + {% endfor %} + +
IdField1Field2CustomfieldActions
{{ entity.id }}{{ entity.field1 }}{{ entity.field2 }}{{ dump(entity.customField) }} + +
+ + + {% endblock %} diff --git a/Resources/views/BlopEntity/new.html.twig b/Resources/views/BlopEntity/new.html.twig new file mode 100644 index 000000000..9d9d15292 --- /dev/null +++ b/Resources/views/BlopEntity/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

BlopEntity creation

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

BlopEntity

+ + + + + + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Field1{{ entity.field1 }}
Field2{{ entity.field2 }}
Customfield{{ dump(entity.customField) }}
+ + +{% endblock %} diff --git a/Resources/views/BlopEntity2/edit.html.twig b/Resources/views/BlopEntity2/edit.html.twig new file mode 100644 index 000000000..c60322926 --- /dev/null +++ b/Resources/views/BlopEntity2/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

BlopEntity2 edit

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

BlopEntity2 list

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

BlopEntity2 creation

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

BlopEntity2

+ + + + + + + + + + + + +
Id{{ entity.id }}
CustomfieldData{{ entity.customFieldData }}
+ + +{% endblock %} diff --git a/Resources/views/CustomField/edit.html.twig b/Resources/views/CustomField/edit.html.twig new file mode 100644 index 000000000..bfbe14f58 --- /dev/null +++ b/Resources/views/CustomField/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

CustomField edit

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

CustomField list

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

CustomField creation

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

CustomField

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

CustomFieldsGroup edit

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

CustomFieldsGroup list

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

CustomFieldsGroup creation

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

CustomFieldsGroup

+ + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Name{{ entity.name }}
Entity{{ entity.entity }}
+ + +{% endblock %} diff --git a/Resources/views/Default/index.html.twig b/Resources/views/Default/index.html.twig new file mode 100644 index 000000000..4ce626e9b --- /dev/null +++ b/Resources/views/Default/index.html.twig @@ -0,0 +1 @@ +Hello {{ name }}! diff --git a/Resources/views/Entity/edit.html.twig b/Resources/views/Entity/edit.html.twig new file mode 100644 index 000000000..0376acef2 --- /dev/null +++ b/Resources/views/Entity/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Entity edit

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

Entity list

+ + + + + + + + + + + + + {% for entity in entities %} + + + + + + + + {% endfor %} + +
IdField1Field2CustomfieldsActions
{{ entity.id }}{{ entity.field1 }}{{ entity.field2 }}{{ entity.customFields }} + +
+ + + {% endblock %} diff --git a/Resources/views/Entity/new.html.twig b/Resources/views/Entity/new.html.twig new file mode 100644 index 000000000..cee1c0b8e --- /dev/null +++ b/Resources/views/Entity/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

Entity creation

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

Entity

+ + + + + + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Field1{{ entity.field1 }}
Field2{{ entity.field2 }}
Customfields{{ entity.customFields }}
+ + +{% endblock %} diff --git a/Resources/views/TestEntity/edit.html.twig b/Resources/views/TestEntity/edit.html.twig new file mode 100644 index 000000000..2cac0777d --- /dev/null +++ b/Resources/views/TestEntity/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

TestEntity edit

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

TestEntity list

+ + + + + + + + + + + + + {% for entity in entities %} + + + + + + + + {% endfor %} + +
IdField1Field2CustomfieldsActions
{{ entity.id }}{{ entity.field1 }}{{ entity.field2 }}{{ entity.customFields }} + +
+ + + {% endblock %} diff --git a/Resources/views/TestEntity/new.html.twig b/Resources/views/TestEntity/new.html.twig new file mode 100644 index 000000000..d17621c81 --- /dev/null +++ b/Resources/views/TestEntity/new.html.twig @@ -0,0 +1,15 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

TestEntity creation

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

TestEntity

+ + + + + + + + + + + + + + + + + + + + +
Id{{ entity.id }}
Field1{{ entity.field1 }}
Field2{{ entity.field2 }}
Customfields{{ entity.customFields }}
+ + +{% endblock %} diff --git a/Resources/views/TestExtraColumn/edit.html.twig b/Resources/views/TestExtraColumn/edit.html.twig new file mode 100644 index 000000000..144c0e5a9 --- /dev/null +++ b/Resources/views/TestExtraColumn/edit.html.twig @@ -0,0 +1,16 @@ +{% extends '::base.html.twig' %} + +{% block body -%} +

TestExtraColumn edit

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

TestExtraColumn list

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

TestExtraColumn creation

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

TestExtraColumn

+ + + + + + + + + + + + +
Id{{ entity.id }}
Name{{ entity.name }}
+ + +{% endblock %} diff --git a/Service/CustomFieldProvider.php b/Service/CustomFieldProvider.php new file mode 100644 index 000000000..f7118ce0a --- /dev/null +++ b/Service/CustomFieldProvider.php @@ -0,0 +1,58 @@ + + */ +class CustomFieldProvider implements ContainerAwareInterface +{ + private $servicesByType = array(); + + /** + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + private $container; + + public function addCustomField($serviceName, $type) + { + $this->servicesByType[$type] = $serviceName; + } + + /** + * + * @param string $type + * @return CustomFieldInterface + */ + public function getCustomFieldByType($type) + { + if (isset($this->servicesByType[$type])) { + return $this->servicesByType[$type]; + } else { + throw new \LogicException('the custom field with type '.$type.' ' + . 'is not found'); + } + } + + public function setContainer(ContainerInterface $container = null) + { + if ($container === null) { + throw new \LogicException('container should not be null'); + } + + $this->container = $container; + } + + public function getAllFields() + { + return $this->servicesByType; + } + +} diff --git a/Tests/Config/ConfigCustomizablesEntitiesTest.php b/Tests/Config/ConfigCustomizablesEntitiesTest.php new file mode 100644 index 000000000..9d0cc8e6e --- /dev/null +++ b/Tests/Config/ConfigCustomizablesEntitiesTest.php @@ -0,0 +1,41 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +namespace Chill\CustomFieldsBundle\Tests\Config; + +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; + +/** + * Test the option Customizables_entities + * + * @author Julien Fastré + */ +class ConfigCustomizablesEntitiesTest extends KernelTestCase +{ + public function testEmptyConfig() + { + self::bootKernel(array('environment' => 'test')); + $customizableEntities = static::$kernel->getContainer() + ->getParameter('chill_custom_fields.customizables_entities'); + + $this->assertInternalType('array', $customizableEntities); + $this->assertCount(0, $customizableEntities); + } +} diff --git a/Tests/Controller/AdressControllerTest_TODO.php b/Tests/Controller/AdressControllerTest_TODO.php new file mode 100644 index 000000000..7d1a9874f --- /dev/null +++ b/Tests/Controller/AdressControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/adress/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /adress/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_adress[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( + 'cl_customfieldsbundle_adress[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/BlopEntity2ControllerTest_TODO.php b/Tests/Controller/BlopEntity2ControllerTest_TODO.php new file mode 100644 index 000000000..8b5700df2 --- /dev/null +++ b/Tests/Controller/BlopEntity2ControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/blopentity2/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /blopentity2/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_blopentity2[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( + 'cl_customfieldsbundle_blopentity2[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/BlopEntityControllerTest_TODO.php b/Tests/Controller/BlopEntityControllerTest_TODO.php new file mode 100644 index 000000000..47f920de6 --- /dev/null +++ b/Tests/Controller/BlopEntityControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/blopentity/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /blopentity/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_blopentity[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( + 'cl_customfieldsbundle_blopentity[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/CustomFieldControllerTest_TODO.php b/Tests/Controller/CustomFieldControllerTest_TODO.php new file mode 100644 index 000000000..c41de20e0 --- /dev/null +++ b/Tests/Controller/CustomFieldControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/customfield/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /customfield/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_customfield[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( + 'cl_customfieldsbundle_customfield[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/CustomFieldsGroupControllerTest_TODO.php b/Tests/Controller/CustomFieldsGroupControllerTest_TODO.php new file mode 100644 index 000000000..afa7bad25 --- /dev/null +++ b/Tests/Controller/CustomFieldsGroupControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/customfieldsgroup/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /customfieldsgroup/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_customfieldsgroup[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( + 'cl_customfieldsbundle_customfieldsgroup[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/EntityControllerTest_TODO.php b/Tests/Controller/EntityControllerTest_TODO.php new file mode 100644 index 000000000..427f13a16 --- /dev/null +++ b/Tests/Controller/EntityControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/entity/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /entity/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_entity[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( + 'cl_customfieldsbundle_entity[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/TestEntityControllerTest_TODO.php b/Tests/Controller/TestEntityControllerTest_TODO.php new file mode 100644 index 000000000..b6e7d6fe7 --- /dev/null +++ b/Tests/Controller/TestEntityControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/testentity/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /testentity/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_testentity[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( + 'cl_customfieldsbundle_testentity[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/TestExtraColumnControllerTest_TODO.php b/Tests/Controller/TestExtraColumnControllerTest_TODO.php new file mode 100644 index 000000000..e83f5cd9a --- /dev/null +++ b/Tests/Controller/TestExtraColumnControllerTest_TODO.php @@ -0,0 +1,55 @@ +request('GET', '/testextracolumn/'); + $this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /testextracolumn/"); + $crawler = $client->click($crawler->selectLink('Create a new entry')->link()); + + // Fill in the form and submit it + $form = $crawler->selectButton('Create')->form(array( + 'cl_customfieldsbundle_testextracolumn[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( + 'cl_customfieldsbundle_testextracolumn[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/Fixtures/App/app/AppKernel.php b/Tests/Fixtures/App/app/AppKernel.php new file mode 100644 index 000000000..194a82a11 --- /dev/null +++ b/Tests/Fixtures/App/app/AppKernel.php @@ -0,0 +1,42 @@ +load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); + } + + /** + * @return string + */ + public function getCacheDir() + { + return sys_get_temp_dir().'/CustomFieldsBundle/cache'; + } + + /** + * @return string + */ + public function getLogDir() + { + return sys_get_temp_dir().'/CustomFieldsBundle/logs'; + } +} + diff --git a/Tests/Fixtures/App/app/config/config.yml b/Tests/Fixtures/App/app/config/config.yml new file mode 100644 index 000000000..e34d866e7 --- /dev/null +++ b/Tests/Fixtures/App/app/config/config.yml @@ -0,0 +1,27 @@ +imports: + - { resource: parameters.yml } + +framework: + secret: Not very secret + router: { resource: "%kernel.root_dir%/config/routing.yml" } + form: true + csrf_protection: true + session: ~ + default_locale: fr + translator: { fallback: fr } + profiler: { only_exceptions: false } + templating: + engines: ['twig'] + +doctrine: + dbal: + driver: pdo_pgsql + host: "%database_host%" + port: "%database_port%" + dbname: "%database_name%" + user: "%database_user%" + password: "%database_password%" + charset: UTF8 + orm: + auto_generate_proxy_classes: "%kernel.debug%" + auto_mapping: true \ No newline at end of file diff --git a/Tests/Fixtures/App/app/config/config_dev.yml b/Tests/Fixtures/App/app/config/config_dev.yml new file mode 100644 index 000000000..81e0f80f4 --- /dev/null +++ b/Tests/Fixtures/App/app/config/config_dev.yml @@ -0,0 +1,7 @@ +imports: + - { resource: config.yml } #here we import a config.yml file, this is not required + +framework: + test: ~ + session: + storage_id: session.storage.filesystem \ No newline at end of file diff --git a/Tests/Fixtures/App/app/config/config_test.yml b/Tests/Fixtures/App/app/config/config_test.yml new file mode 100644 index 000000000..fbef213f6 --- /dev/null +++ b/Tests/Fixtures/App/app/config/config_test.yml @@ -0,0 +1,8 @@ +# config/config_test.yml +imports: + - { resource: config.yml } #here we import a config.yml file, this is not required + +framework: + test: ~ + session: + storage_id: session.storage.filesystem \ No newline at end of file diff --git a/Tests/Fixtures/App/app/config/parameters.yml.dist b/Tests/Fixtures/App/app/config/parameters.yml.dist new file mode 100644 index 000000000..fa3e55dae --- /dev/null +++ b/Tests/Fixtures/App/app/config/parameters.yml.dist @@ -0,0 +1,6 @@ +parameters: + database_host: 127.0.0.1 + database_port: 5434 + database_name: symfony + database_user: symfony + database_password: symfony \ No newline at end of file diff --git a/Tests/Fixtures/App/app/config/routing.yml b/Tests/Fixtures/App/app/config/routing.yml new file mode 100644 index 000000000..38660f8c9 --- /dev/null +++ b/Tests/Fixtures/App/app/config/routing.yml @@ -0,0 +1,4 @@ +cl_custom_fields: + resource: "@ChillCustomFieldsBundle/Resources/config/routing.yml" + prefix: / + diff --git a/Tests/Fixtures/App/app/console.php b/Tests/Fixtures/App/app/console.php new file mode 100644 index 000000000..cf7efc348 --- /dev/null +++ b/Tests/Fixtures/App/app/console.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getParameterOption(array('--env', '-e'), getenv('SYMFONY_ENV') ?: 'dev'); +$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(array('--no-debug', '')) && $env !== 'prod'; +if ($debug) { +Debug::enable(); +} +$kernel = new AppKernel($env, $debug); +$application = new Application($kernel); +$application->run($input); + diff --git a/Tests/Fixtures/App/web/app_dev.php b/Tests/Fixtures/App/web/app_dev.php new file mode 100644 index 000000000..e0279c2ae --- /dev/null +++ b/Tests/Fixtures/App/web/app_dev.php @@ -0,0 +1,30 @@ +loadClassCache(); +$request = Request::createFromGlobals(); +$response = $kernel->handle($request); +$response->send(); +$kernel->terminate($request, $response); diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100644 index 000000000..9211155e5 --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,8 @@ +add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs'); - } - - AnnotationRegistry::registerLoader(array($loader, 'loadClass')); - - return $loader; - -### `app/config/config.yml` - -The `framework.charset` setting must be removed. If you are not using `UTF-8` -for your application, override the `getCharset()` method in your `AppKernel` -class instead: - - class AppKernel extends Kernel - { - public function getCharset() - { - return 'ISO-8859-1'; - } - - // ... - } - -You might want to add the new `strict_requirements` parameter to -`framework.router` (it avoids fatal errors in the production environment when -a link cannot be generated): - - framework: - router: - strict_requirements: "%kernel.debug%" - -You can even disable the requirements check on production with `null` as you should -know that the parameters for URL generation always pass the requirements, e.g. by -validating them beforehand. This additionally enhances performance. See -[config_prod.yml](https://github.com/symfony/symfony-standard/blob/master/app/config/config_prod.yml). - -The `default_locale` parameter is now a setting of the main `framework` -configuration (it was under the `framework.session` in 2.0): - - framework: - default_locale: "%locale%" - -The `auto_start` setting under `framework.session` must be removed as it is -not used anymore (the session is now always started on-demand). If -`auto_start` was the only setting under the `framework.session` entry, don't -remove it entirely, but set its value to `~` (`~` means `null` in YAML) -instead: - - framework: - session: ~ - -The `trust_proxy_headers` setting was added in the default configuration file -(as it should be set to `true` when you install your application behind a -reverse proxy): - - framework: - trust_proxy_headers: false - -An empty `bundles` entry was added to the `assetic` configuration: - - assetic: - bundles: [] - -The default `swiftmailer` configuration now has the `spool` setting configured -to the `memory` type to defer email sending after the response is sent to the -user (recommended for better end-user performance): - - swiftmailer: - spool: { type: memory } - -The `jms_security_extra` configuration was moved to the `security.yml` -configuration file. - -### `app/config/config_dev.yml` - -An example of how to send all emails to a unique address was added: - - #swiftmailer: - # delivery_address: me@example.com - -### `app/config/config_test.yml` - -The `storage_id` setting must be changed to `session.storage.mock_file`: - - framework: - session: - storage_id: session.storage.mock_file - -### `app/config/parameters.ini` - -The file has been converted to a YAML file which reads as follows: - - parameters: - database_driver: pdo_mysql - database_host: localhost - database_port: ~ - database_name: symfony - database_user: root - database_password: ~ - - mailer_transport: smtp - mailer_host: localhost - mailer_user: ~ - mailer_password: ~ - - locale: en - secret: ThisTokenIsNotSoSecretChangeIt - -Note that if you convert your parameters file to YAML, you must also change -its reference in `app/config/config.yml`. - -### `app/config/routing_dev.yml` - -The `_assetic` entry was removed: - - #_assetic: - # resource: . - # type: assetic - -### `app/config/security.yml` - -Under `security.access_control`, the default rule for internal routes was changed: - - security: - access_control: - #- { path: ^/_internal/secure, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } - -Under `security.providers`, the `in_memory` example was updated to the following: - - security: - providers: - in_memory: - memory: - users: - user: { password: userpass, roles: [ 'ROLE_USER' ] } - admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] } - -### `app/AppKernel.php` - -The following bundles have been added to the list of default registered bundles: - - new JMS\AopBundle\JMSAopBundle(), - new JMS\DiExtraBundle\JMSDiExtraBundle($this), - -You must also rename the DoctrineBundle from: - - new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), - -to: - - new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), - -### `web/app.php` - -The default `web/app.php` file now reads as follows: - - register(true); - */ - - require_once __DIR__.'/../app/AppKernel.php'; - //require_once __DIR__.'/../app/AppCache.php'; - - $kernel = new AppKernel('prod', false); - $kernel->loadClassCache(); - //$kernel = new AppCache($kernel); - $request = Request::createFromGlobals(); - $response = $kernel->handle($request); - $response->send(); - $kernel->terminate($request, $response); - -### `web/app_dev.php` - -The default `web/app_dev.php` file now reads as follows: - - loadClassCache(); - $request = Request::createFromGlobals(); - $response = $kernel->handle($request); - $response->send(); - $kernel->terminate($request, $response); diff --git a/composer.json b/composer.json index ff76f53ca..ab82fba00 100644 --- a/composer.json +++ b/composer.json @@ -1,60 +1,31 @@ { - "name": "symfony/framework-standard-edition", - "license": "MIT", - "type": "project", - "description": "The \"Symfony Standard Edition\" distribution", - "minimum-stability": "dev", + "name": "chill-project/custom-fields", + "license": "AGPL-3.0", + "type": "symfony-bundle", + "description": "This bundle allow to add custom fields on entities.", + "keywords" : ["chill", "social work"], + "homepage" : "https://github.com/Chill-project/custom-fields", "autoload": { - "psr-0": { "": "src/", "SymfonyStandard": "app/" } + "psr-4": { "Chill\\CustomFieldsBundle\\": "" } }, + "authors" : [ + { + "name": "Champs-Libres", + "email": "info@champs-libres.coop", + "homepage": "http://www.champs-libres.coop" + } + ], "require": { - "php": ">=5.3.3", + "php": "~5.5", "symfony/symfony": "2.5.*", - "doctrine/orm": "2.5.x-dev", - "doctrine/doctrine-bundle": "~1.2", + "doctrine/orm": "~2.5@dev", + "doctrine/dbal" : "~2.5@dev", + "doctrine/doctrine-bundle": "~1.2@dev", "twig/extensions": "~1.0", "symfony/assetic-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.4", "sensio/distribution-bundle": "~3.0", - "sensio/framework-extra-bundle": "~3.0", - "incenteev/composer-parameter-handler": "~2.0" - }, - "require-dev": { - "sensio/generator-bundle": "~2.3" - }, - "scripts": { - "post-root-package-install": [ - "SymfonyStandard\\Composer::hookRootPackageInstall" - ], - "post-install-cmd": [ - "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" - ], - "post-update-cmd": [ - "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", - "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles" - ] - }, - "config": { - "bin-dir": "bin" - }, - "extra": { - "symfony-app-dir": "app", - "symfony-web-dir": "web", - "incenteev-parameters": { - "file": "app/config/parameters.yml" - }, - "branch-alias": { - "dev-master": "2.5-dev" - } + "sensio/framework-extra-bundle": "~3.0" } } diff --git a/composer.lock b/composer.lock index 5d28ff16e..1fbbd5c1a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "6f86c5d551cb4fffc0e4261cdbf98c47", + "hash": "613da7bdafb635871598befc4df4337a", "packages": [ { "name": "doctrine/annotations", - "version": "dev-master", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "e93f3b718c421daddff58c4a4af1aee574472cd6" + "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/e93f3b718c421daddff58c4a4af1aee574472cd6", - "reference": "e93f3b718c421daddff58c4a4af1aee574472cd6", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/6a6bec0670bb6e71a263b08bc1b98ea242928633", + "reference": "6a6bec0670bb6e71a263b08bc1b98ea242928633", "shasum": "" }, "require": { @@ -72,20 +72,20 @@ "docblock", "parser" ], - "time": "2014-07-27 16:33:24" + "time": "2014-09-25 16:45:30" }, { "name": "doctrine/cache", - "version": "dev-master", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "daba57d377f2620ce0355797acad538fc682e3a4" + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/daba57d377f2620ce0355797acad538fc682e3a4", - "reference": "daba57d377f2620ce0355797acad538fc682e3a4", + "url": "https://api.github.com/repos/doctrine/cache/zipball/cf483685798a72c93bf4206e3dd6358ea07d64e7", + "reference": "cf483685798a72c93bf4206e3dd6358ea07d64e7", "shasum": "" }, "require": { @@ -141,28 +141,25 @@ "cache", "caching" ], - "time": "2014-08-30 05:24:19" + "time": "2014-09-17 14:24:04" }, { "name": "doctrine/collections", - "version": "dev-master", + "version": "v1.2", "source": { "type": "git", "url": "https://github.com/doctrine/collections.git", - "reference": "432240f56fbc9a811dbf1ff8a45c1a1047ba1c0a" + "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/432240f56fbc9a811dbf1ff8a45c1a1047ba1c0a", - "reference": "432240f56fbc9a811dbf1ff8a45c1a1047ba1c0a", + "url": "https://api.github.com/repos/doctrine/collections/zipball/b99c5c46c87126201899afe88ec490a25eedd6a2", + "reference": "b99c5c46c87126201899afe88ec490a25eedd6a2", "shasum": "" }, "require": { "php": ">=5.3.2" }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, "type": "library", "extra": { "branch-alias": { @@ -179,6 +176,17 @@ "MIT" ], "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -187,17 +195,11 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, { "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" } ], "description": "Collections Abstraction library", @@ -207,20 +209,20 @@ "collections", "iterator" ], - "time": "2014-07-29 20:07:28" + "time": "2014-02-03 23:07:43" }, { "name": "doctrine/common", - "version": "2.4.x-dev", + "version": "v2.4.2", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "ae92d076442e27b6910dd86a1292a8867cf5cfe4" + "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/ae92d076442e27b6910dd86a1292a8867cf5cfe4", - "reference": "ae92d076442e27b6910dd86a1292a8867cf5cfe4", + "url": "https://api.github.com/repos/doctrine/common/zipball/5db6ab40e4c531f14dad4ca96a394dfce5d4255b", + "reference": "5db6ab40e4c531f14dad4ca96a394dfce5d4255b", "shasum": "" }, "require": { @@ -285,7 +287,7 @@ "persistence", "spl" ], - "time": "2014-05-21 19:29:23" + "time": "2014-05-21 19:28:51" }, { "name": "doctrine/dbal", @@ -293,20 +295,20 @@ "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "fabf5c5316cb1fbbe2558d98e9d51454cbf05360" + "reference": "d12672808124e711c2cb78a82d4461ba2e89c7ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/fabf5c5316cb1fbbe2558d98e9d51454cbf05360", - "reference": "fabf5c5316cb1fbbe2558d98e9d51454cbf05360", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/d12672808124e711c2cb78a82d4461ba2e89c7ef", + "reference": "d12672808124e711c2cb78a82d4461ba2e89c7ef", "shasum": "" }, "require": { - "doctrine/common": "2.4.*", + "doctrine/common": ">=2.4,<2.6-dev", "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "4.0.*", + "phpunit/phpunit": "4.*", "symfony/console": "2.*" }, "suggest": { @@ -356,7 +358,7 @@ "persistence", "queryobject" ], - "time": "2014-09-02 10:05:11" + "time": "2014-10-29 16:12:22" }, { "name": "doctrine/doctrine-bundle", @@ -364,12 +366,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "f4672bf856259f5665e8144cddf3eb0924f23d63" + "reference": "d9763ccbb637958133c42bdcc3d31c5a6821b9e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/f4672bf856259f5665e8144cddf3eb0924f23d63", - "reference": "f4672bf856259f5665e8144cddf3eb0924f23d63", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d9763ccbb637958133c42bdcc3d31c5a6821b9e2", + "reference": "d9763ccbb637958133c42bdcc3d31c5a6821b9e2", "shasum": "" }, "require": { @@ -435,21 +437,21 @@ "orm", "persistence" ], - "time": "2014-08-26 07:35:11" + "time": "2014-10-04 16:13:24" }, { "name": "doctrine/doctrine-cache-bundle", - "version": "dev-master", + "version": "1.0.0", "target-dir": "Doctrine/Bundle/DoctrineCacheBundle", "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineCacheBundle.git", - "reference": "03b4890d61580d1bee710445abdf158bb224b251" + "reference": "49a9d2d9a35863201e5e608d1194db28946c4552" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/03b4890d61580d1bee710445abdf158bb224b251", - "reference": "03b4890d61580d1bee710445abdf158bb224b251", + "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/49a9d2d9a35863201e5e608d1194db28946c4552", + "reference": "49a9d2d9a35863201e5e608d1194db28946c4552", "shasum": "" }, "require": { @@ -486,6 +488,12 @@ "MIT" ], "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, { "name": "Symfony Community", "homepage": "http://symfony.com/contributors" @@ -505,10 +513,6 @@ { "name": "Doctrine Project", "homepage": "http://www.doctrine-project.org/" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" } ], "description": "Symfony2 Bundle for Doctrine Cache", @@ -517,34 +521,26 @@ "cache", "caching" ], - "time": "2014-07-30 14:46:58" + "time": "2014-03-04 19:18:55" }, { "name": "doctrine/inflector", - "version": "dev-master", + "version": "v1.0", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "64de2fe36d578c5d5f3807ac7984547bbba5f7c5" + "reference": "54b8333d2a5682afdc690060c1cf384ba9f47f08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/64de2fe36d578c5d5f3807ac7984547bbba5f7c5", - "reference": "64de2fe36d578c5d5f3807ac7984547bbba5f7c5", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/54b8333d2a5682afdc690060c1cf384ba9f47f08", + "reference": "54b8333d2a5682afdc690060c1cf384ba9f47f08", "shasum": "" }, "require": { "php": ">=5.3.2" }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" @@ -585,28 +581,28 @@ "homepage": "http://www.doctrine-project.org", "keywords": [ "inflection", - "pluralize", - "singularize", + "pluarlize", + "singuarlize", "string" ], - "time": "2014-04-23 12:36:11" + "time": "2013-01-10 21:49:15" }, { "name": "doctrine/instantiator", - "version": "dev-master", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "26404e0c90565b614ee76b988b9bc8790d77f590" + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/26404e0c90565b614ee76b988b9bc8790d77f590", - "reference": "26404e0c90565b614ee76b988b9bc8790d77f590", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/f976e5de371104877ebc89bd8fecb0019ed9c119", + "reference": "f976e5de371104877ebc89bd8fecb0019ed9c119", "shasum": "" }, "require": { - "php": "~5.3" + "php": ">=5.3,<8.0-DEV" }, "require-dev": { "athletic/athletic": "~0.1.8", @@ -643,31 +639,26 @@ "constructor", "instantiate" ], - "time": "2014-08-25 15:09:25" + "time": "2014-10-13 12:58:55" }, { "name": "doctrine/lexer", - "version": "dev-master", + "version": "v1.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "db77c80d33d72e33a62b80581e9d150af85de556" + "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/db77c80d33d72e33a62b80581e9d150af85de556", - "reference": "db77c80d33d72e33a62b80581e9d150af85de556", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/2f708a85bb3aab5d99dab8be435abd73e0b18acb", + "reference": "2f708a85bb3aab5d99dab8be435abd73e0b18acb", "shasum": "" }, "require": { "php": ">=5.3.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" @@ -700,7 +691,7 @@ "lexer", "parser" ], - "time": "2014-06-11 23:09:27" + "time": "2013-01-12 18:59:04" }, { "name": "doctrine/orm", @@ -708,12 +699,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "d9b43dc6492b163fc46f40c0555e2a7015ef5b68" + "reference": "20c6bfd360b3db9e9bc53e5ae37afe1a22dccca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/d9b43dc6492b163fc46f40c0555e2a7015ef5b68", - "reference": "d9b43dc6492b163fc46f40c0555e2a7015ef5b68", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/20c6bfd360b3db9e9bc53e5ae37afe1a22dccca3", + "reference": "20c6bfd360b3db9e9bc53e5ae37afe1a22dccca3", "shasum": "" }, "require": { @@ -722,7 +713,7 @@ "doctrine/instantiator": "~1.0.1", "ext-pdo": "*", "php": ">=5.3.2", - "symfony/console": "2.*" + "symfony/console": "~2.3" }, "require-dev": { "phpunit/phpunit": "~4.0", @@ -775,72 +766,20 @@ "database", "orm" ], - "time": "2014-08-30 02:22:47" - }, - { - "name": "incenteev/composer-parameter-handler", - "version": "dev-master", - "target-dir": "Incenteev/ParameterHandler", - "source": { - "type": "git", - "url": "https://github.com/Incenteev/ParameterHandler.git", - "reference": "ea15f3dd22e5720eec244afb9bf2d5737a0b6c76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Incenteev/ParameterHandler/zipball/ea15f3dd22e5720eec244afb9bf2d5737a0b6c76", - "reference": "ea15f3dd22e5720eec244afb9bf2d5737a0b6c76", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/yaml": "~2.0" - }, - "require-dev": { - "composer/composer": "1.0.*@dev", - "phpspec/prophecy-phpunit": "~1.0", - "symfony/filesystem": "~2.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "psr-0": { - "Incenteev\\ParameterHandler": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Christophe Coevoet", - "email": "stof@notk.org" - } - ], - "description": "Composer script handling your ignored parameter file", - "homepage": "https://github.com/Incenteev/ParameterHandler", - "keywords": [ - "parameters management" - ], - "time": "2014-08-20 22:30:03" + "time": "2014-10-23 05:01:59" }, { "name": "jdorn/sql-formatter", - "version": "dev-master", + "version": "v1.2.17", "source": { "type": "git", "url": "https://github.com/jdorn/sql-formatter.git", - "reference": "ff0515fa8ce7d97d6cba279e8ed9d51d3eaa0316" + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/ff0515fa8ce7d97d6cba279e8ed9d51d3eaa0316", - "reference": "ff0515fa8ce7d97d6cba279e8ed9d51d3eaa0316", + "url": "https://api.github.com/repos/jdorn/sql-formatter/zipball/64990d96e0959dff8e059dfcdc1af130728d92bc", + "reference": "64990d96e0959dff8e059dfcdc1af130728d92bc", "shasum": "" }, "require": { @@ -849,9 +788,6 @@ "require-dev": { "phpunit/phpunit": "3.7.*" }, - "bin": [ - "bin/sql-formatter" - ], "type": "library", "extra": { "branch-alias": { @@ -880,20 +816,20 @@ "highlight", "sql" ], - "time": "2014-07-28 13:45:38" + "time": "2014-01-12 16:20:24" }, { "name": "kriswallsmith/assetic", - "version": "dev-master", + "version": "v1.2.0", "source": { "type": "git", "url": "https://github.com/kriswallsmith/assetic.git", - "reference": "7c9639d93558c96ade44f60a4d201b29d68c4d7b" + "reference": "df991c124a2212371443b586a1be767500036dee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/7c9639d93558c96ade44f60a4d201b29d68c4d7b", - "reference": "7c9639d93558c96ade44f60a4d201b29d68c4d7b", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/df991c124a2212371443b586a1be767500036dee", + "reference": "df991c124a2212371443b586a1be767500036dee", "shasum": "" }, "require": { @@ -908,8 +844,8 @@ "leafo/scssphp": "*", "leafo/scssphp-compass": "*", "mrclay/minify": "*", - "patchwork/jsqueeze": "*", - "phpunit/phpunit": "~3.7", + "patchwork/jsqueeze": "~1.0", + "phpunit/phpunit": "~4", "psr/log": "~1.0", "ptachoire/cssembed": "*", "twig/twig": "~1.6" @@ -954,20 +890,20 @@ "compression", "minification" ], - "time": "2014-08-27 14:48:43" + "time": "2014-10-14 14:45:32" }, { "name": "monolog/monolog", - "version": "dev-master", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "12545cda2f7a0bd82a110f742ef455fe735e60cf" + "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/12545cda2f7a0bd82a110f742ef455fe735e60cf", - "reference": "12545cda2f7a0bd82a110f742ef455fe735e60cf", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/ec3961874c43840e96da3a8a1ed20d8c73d7e5aa", + "reference": "ec3961874c43840e96da3a8a1ed20d8c73d7e5aa", "shasum": "" }, "require": { @@ -1026,28 +962,23 @@ "logging", "psr-3" ], - "time": "2014-07-31 22:12:22" + "time": "2014-09-30 13:30:58" }, { "name": "psr/log", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "a78d6504ff5d4367497785ab2ade91db3a9fbe11" + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/a78d6504ff5d4367497785ab2ade91db3a9fbe11", - "reference": "a78d6504ff5d4367497785ab2ade91db3a9fbe11", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", "shasum": "" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-0": { "Psr\\Log\\": "" @@ -1069,21 +1000,21 @@ "psr", "psr-3" ], - "time": "2014-01-18 15:33:09" + "time": "2012-12-21 11:40:51" }, { "name": "sensio/distribution-bundle", - "version": "dev-master", + "version": "v3.0.8", "target-dir": "Sensio/Bundle/DistributionBundle", "source": { "type": "git", "url": "https://github.com/sensiolabs/SensioDistributionBundle.git", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469" + "reference": "bc5e96bb4faf6bee7121085951d11b89488952f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/ad10123f2532f6e311e583cce203ef368eedc469", - "reference": "ad10123f2532f6e311e583cce203ef368eedc469", + "url": "https://api.github.com/repos/sensiolabs/SensioDistributionBundle/zipball/bc5e96bb4faf6bee7121085951d11b89488952f5", + "reference": "bc5e96bb4faf6bee7121085951d11b89488952f5", "shasum": "" }, "require": { @@ -1091,7 +1022,7 @@ "sensiolabs/security-checker": "~2.0", "symfony/class-loader": "~2.2", "symfony/form": "~2.2", - "symfony/framework-bundle": "~2.4", + "symfony/framework-bundle": "~2.3", "symfony/process": "~2.2", "symfony/validator": "~2.2", "symfony/yaml": "~2.2" @@ -1122,11 +1053,11 @@ "configuration", "distribution" ], - "time": "2014-08-26 13:14:47" + "time": "2014-11-03 21:16:34" }, { "name": "sensio/framework-extra-bundle", - "version": "dev-master", + "version": "v3.0.2", "target-dir": "Sensio/Bundle/FrameworkExtraBundle", "source": { "type": "git", @@ -1181,7 +1112,7 @@ }, { "name": "sensiolabs/security-checker", - "version": "dev-master", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/sensiolabs/security-checker.git", @@ -1226,20 +1157,20 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "dev-master", + "version": "v5.3.0", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "8a2bcc6045e92acfbfea252cb6b444bc8c3f171e" + "reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/8a2bcc6045e92acfbfea252cb6b444bc8c3f171e", - "reference": "8a2bcc6045e92acfbfea252cb6b444bc8c3f171e", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/b86b927dfefdb56ab0b22d1350033d9a38e9f205", + "reference": "b86b927dfefdb56ab0b22d1350033d9a38e9f205", "shasum": "" }, "require": { - "php": ">=5.2.4" + "php": ">=5.3.3" }, "require-dev": { "mockery/mockery": "~0.9.1" @@ -1247,7 +1178,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2-dev" + "dev-master": "5.3-dev" } }, "autoload": { @@ -1274,44 +1205,45 @@ "mail", "mailer" ], - "time": "2014-08-27 09:29:44" + "time": "2014-10-04 05:53:18" }, { "name": "symfony/assetic-bundle", - "version": "dev-master", + "version": "v2.5.0", "source": { "type": "git", "url": "https://github.com/symfony/AsseticBundle.git", - "reference": "02d4ba289d2e758bb69dc4d78cd4e99160673132" + "reference": "90ea7fb66d6d5245fd4afc16e4c8070214254fec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/02d4ba289d2e758bb69dc4d78cd4e99160673132", - "reference": "02d4ba289d2e758bb69dc4d78cd4e99160673132", + "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/90ea7fb66d6d5245fd4afc16e4c8070214254fec", + "reference": "90ea7fb66d6d5245fd4afc16e4c8070214254fec", "shasum": "" }, "require": { "kriswallsmith/assetic": "~1.2", "php": ">=5.3.0", - "symfony/framework-bundle": "~2.1" - }, - "require-dev": { - "symfony/class-loader": "~2.1", "symfony/console": "~2.1", - "symfony/css-selector": "~2.1", - "symfony/dom-crawler": "~2.1", - "symfony/form": "~2.1", - "symfony/twig-bundle": "~2.1", + "symfony/framework-bundle": "~2.1", "symfony/yaml": "~2.1" }, - "suggest": { - "kriswallsmith/spork": "v0.2", + "require-dev": { + "kriswallsmith/spork": "~0.2", + "patchwork/jsqueeze": "~1.0", + "symfony/class-loader": "~2.1", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1", "symfony/twig-bundle": "~2.1" }, + "suggest": { + "kriswallsmith/spork": "to be able to dump assets in parallel", + "symfony/twig-bundle": "to use the Twig integration" + }, "type": "symfony-bundle", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "autoload": { @@ -1337,69 +1269,20 @@ "compression", "minification" ], - "time": "2014-06-30 11:57:15" - }, - { - "name": "symfony/icu", - "version": "1.2.x-dev", - "target-dir": "Symfony/Component/Icu", - "source": { - "type": "git", - "url": "https://github.com/symfony/Icu.git", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Icu/zipball/d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", - "reference": "d4d85d6055b87f394d941b45ddd3a9173e1e3d2a", - "shasum": "" - }, - "require": { - "ext-intl": "*", - "lib-icu": ">=4.4", - "php": ">=5.3.3", - "symfony/intl": "~2.3" - }, - "type": "library", - "autoload": { - "psr-0": { - "Symfony\\Component\\Icu\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Contains an excerpt of the ICU data and classes to load it.", - "homepage": "http://symfony.com", - "keywords": [ - "icu", - "intl" - ], - "time": "2014-07-25 09:58:17" + "time": "2014-10-15 12:03:38" }, { "name": "symfony/monolog-bundle", - "version": "dev-master", + "version": "v2.6.1", "source": { "type": "git", "url": "https://github.com/symfony/MonologBundle.git", - "reference": "1a34465d5f33a2b559dcae7eddd1ef838114994e" + "reference": "227bbeefe30f2d95e3fe5fbd1ccda414287a957a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/1a34465d5f33a2b559dcae7eddd1ef838114994e", - "reference": "1a34465d5f33a2b559dcae7eddd1ef838114994e", + "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/227bbeefe30f2d95e3fe5fbd1ccda414287a957a", + "reference": "227bbeefe30f2d95e3fe5fbd1ccda414287a957a", "shasum": "" }, "require": { @@ -1445,20 +1328,21 @@ "log", "logging" ], - "time": "2014-08-31 13:44:52" + "time": "2014-07-21 00:36:06" }, { "name": "symfony/swiftmailer-bundle", - "version": "dev-master", + "version": "v2.3.7", + "target-dir": "Symfony/Bundle/SwiftmailerBundle", "source": { "type": "git", "url": "https://github.com/symfony/SwiftmailerBundle.git", - "reference": "bff639d4cbe9787272967f4cb3e3accdfbb2653c" + "reference": "e98defd402f72e8b54a029ba4d3ac4cb51dc3577" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/bff639d4cbe9787272967f4cb3e3accdfbb2653c", - "reference": "bff639d4cbe9787272967f4cb3e3accdfbb2653c", + "url": "https://api.github.com/repos/symfony/SwiftmailerBundle/zipball/e98defd402f72e8b54a029ba4d3ac4cb51dc3577", + "reference": "e98defd402f72e8b54a029ba4d3ac4cb51dc3577", "shasum": "" }, "require": { @@ -1472,9 +1356,6 @@ "symfony/http-kernel": "~2.1", "symfony/yaml": "~2.1" }, - "suggest": { - "psr/log": "Allows logging" - }, "type": "symfony-bundle", "extra": { "branch-alias": { @@ -1482,8 +1363,8 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Bundle\\SwiftmailerBundle\\": "" + "psr-0": { + "Symfony\\Bundle\\SwiftmailerBundle": "" } }, "notification-url": "https://packagist.org/downloads/", @@ -1504,27 +1385,26 @@ ], "description": "Symfony SwiftmailerBundle", "homepage": "http://symfony.com", - "time": "2014-07-09 09:12:30" + "time": "2014-04-05 17:15:52" }, { "name": "symfony/symfony", - "version": "2.5.x-dev", + "version": "v2.5.6", "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "afb82e83afc94bbae81c68a64cc45a4709ca5edd" + "reference": "1a1b1e528935f15dd76169f8b1dc3ef97f0d6210" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/afb82e83afc94bbae81c68a64cc45a4709ca5edd", - "reference": "afb82e83afc94bbae81c68a64cc45a4709ca5edd", + "url": "https://api.github.com/repos/symfony/symfony/zipball/1a1b1e528935f15dd76169f8b1dc3ef97f0d6210", + "reference": "1a1b1e528935f15dd76169f8b1dc3ef97f0d6210", "shasum": "" }, "require": { "doctrine/common": "~2.2", "php": ">=5.3.3", "psr/log": "~1.0", - "symfony/icu": "~1.0", "twig/twig": "~1.12" }, "replace": { @@ -1618,20 +1498,20 @@ "keywords": [ "framework" ], - "time": "2014-09-03 12:51:22" + "time": "2014-10-24 06:55:39" }, { "name": "twig/extensions", - "version": "dev-master", + "version": "v1.2.0", "source": { "type": "git", - "url": "https://github.com/fabpot/Twig-extensions.git", - "reference": "b092fb785ef82eb99132deadaf8ca1823a4d75dd" + "url": "https://github.com/twigphp/Twig-extensions.git", + "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/b092fb785ef82eb99132deadaf8ca1823a4d75dd", - "reference": "b092fb785ef82eb99132deadaf8ca1823a4d75dd", + "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/8cf4b9fe04077bd54fc73f4fde83347040c3b8cd", + "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd", "shasum": "" }, "require": { @@ -1646,7 +1526,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1665,25 +1545,25 @@ } ], "description": "Common additional features for Twig that do not directly belong in core", - "homepage": "https://github.com/fabpot/Twig-extensions", + "homepage": "http://twig.sensiolabs.org/doc/extensions/index.html", "keywords": [ "i18n", "text" ], - "time": "2014-08-08 06:16:10" + "time": "2014-10-30 14:30:03" }, { "name": "twig/twig", - "version": "dev-master", + "version": "v1.16.2", "source": { "type": "git", "url": "https://github.com/fabpot/Twig.git", - "reference": "084ca201a737de82323f7613665e7229789aa434" + "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Twig/zipball/084ca201a737de82323f7613665e7229789aa434", - "reference": "084ca201a737de82323f7613665e7229789aa434", + "url": "https://api.github.com/repos/fabpot/Twig/zipball/42f758d9fe2146d1f0470604fc05ee43580873fc", + "reference": "42f758d9fe2146d1f0470604fc05ee43580873fc", "shasum": "" }, "require": { @@ -1727,67 +1607,20 @@ "keywords": [ "templating" ], - "time": "2014-09-02 14:08:17" - } - ], - "packages-dev": [ - { - "name": "sensio/generator-bundle", - "version": "dev-master", - "target-dir": "Sensio/Bundle/GeneratorBundle", - "source": { - "type": "git", - "url": "https://github.com/sensiolabs/SensioGeneratorBundle.git", - "reference": "dd102e9fa7d95440ad0adaf80ee0b64b3d2cce05" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioGeneratorBundle/zipball/dd102e9fa7d95440ad0adaf80ee0b64b3d2cce05", - "reference": "dd102e9fa7d95440ad0adaf80ee0b64b3d2cce05", - "shasum": "" - }, - "require": { - "symfony/console": "~2.0", - "symfony/framework-bundle": "~2.2" - }, - "require-dev": { - "doctrine/orm": "~2.2,>=2.2.3", - "symfony/doctrine-bridge": "~2.2", - "twig/twig": "~1.11" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Sensio\\Bundle\\GeneratorBundle": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "This bundle generates code for you", - "time": "2014-09-01 11:55:41" + "time": "2014-10-17 12:53:44" } ], + "packages-dev": [], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": { - "doctrine/orm": 20 + "doctrine/orm": 20, + "doctrine/dbal": 20, + "doctrine/doctrine-bundle": 20 }, "prefer-stable": false, "platform": { - "php": ">=5.3.3" + "php": "~5.5" }, "platform-dev": [] } diff --git a/console.sh b/console.sh new file mode 100755 index 000000000..c2d0ec406 --- /dev/null +++ b/console.sh @@ -0,0 +1 @@ +php Tests/Fixtures/App/app/console.php $1 $2 $3 $4 $5 diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 000000000..86c84517a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + + + ./Tests + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + + + + \ No newline at end of file diff --git a/run-server.sh b/run-server.sh new file mode 100755 index 000000000..e12b22a86 --- /dev/null +++ b/run-server.sh @@ -0,0 +1 @@ +php Tests/Fixtures/App/app/console.php server:run --docroot=Tests/Fixtures/App/web/