diff --git a/Controller/AdressController.php b/Controller/AdressController.php deleted file mode 100644 index 1a64204cc..000000000 --- a/Controller/AdressController.php +++ /dev/null @@ -1,224 +0,0 @@ -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 deleted file mode 100644 index 9b14e753c..000000000 --- a/Controller/BlopEntity2Controller.php +++ /dev/null @@ -1,226 +0,0 @@ -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 deleted file mode 100644 index 3f833f05d..000000000 --- a/Controller/BlopEntityController.php +++ /dev/null @@ -1,291 +0,0 @@ -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/CustomFields/CustomFieldAddress.php b/CustomFields/CustomFieldAddress.php deleted file mode 100644 index dbcf5efd9..000000000 --- a/CustomFields/CustomFieldAddress.php +++ /dev/null @@ -1,91 +0,0 @@ - - */ -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/Entity/Adress.php b/Entity/Adress.php deleted file mode 100644 index a1fdc8457..000000000 --- a/Entity/Adress.php +++ /dev/null @@ -1,59 +0,0 @@ -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 deleted file mode 100644 index b321559a1..000000000 --- a/Entity/BlopEntity.php +++ /dev/null @@ -1,161 +0,0 @@ -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 deleted file mode 100644 index 60b4682ad..000000000 --- a/Entity/BlopEntity2.php +++ /dev/null @@ -1,247 +0,0 @@ - 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/Resources/config/doctrine/Adress.orm.yml b/Resources/config/doctrine/Adress.orm.yml deleted file mode 100644 index ff23bdc27..000000000 --- a/Resources/config/doctrine/Adress.orm.yml +++ /dev/null @@ -1,14 +0,0 @@ -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 deleted file mode 100644 index e2a24f962..000000000 --- a/Resources/config/doctrine/BlopEntity.orm.yml +++ /dev/null @@ -1,23 +0,0 @@ -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 deleted file mode 100644 index f05897041..000000000 --- a/Resources/config/doctrine/BlopEntity2.orm.yml +++ /dev/null @@ -1,16 +0,0 @@ -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/routing.yml b/Resources/config/routing.yml index da9956fda..42718a48c 100644 --- a/Resources/config/routing.yml +++ b/Resources/config/routing.yml @@ -2,22 +2,10 @@ chill_customfields_customfieldsgroup: resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfieldsgroup.yml" prefix: / -chill_customfields_blopentity2: - resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity2.yml" - prefix: /blopentity2 - -chill_customfields_adress: - resource: "@ChillCustomFieldsBundle/Resources/config/routing/adress.yml" - prefix: /adress - chill_customfields_customfield: resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfield.yml" prefix: / -chill_customfields_blopentity: - resource: "@ChillCustomFieldsBundle/Resources/config/routing/blopentity.yml" - prefix: / - chill_customfields_customfieldsdefaultgroup: resource: "@ChillCustomFieldsBundle/Resources/config/routing/customfieldsdefaultgroup.yml" prefix: / \ No newline at end of file diff --git a/Resources/config/routing/adress.yml b/Resources/config/routing/adress.yml deleted file mode 100644 index 667f87b6c..000000000 --- a/Resources/config/routing/adress.yml +++ /dev/null @@ -1,30 +0,0 @@ -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 deleted file mode 100644 index 78ff9b0f8..000000000 --- a/Resources/config/routing/blopentity.yml +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 9ca2c0de2..000000000 --- a/Resources/config/routing/blopentity2.yml +++ /dev/null @@ -1,30 +0,0 @@ -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/views/Adress/edit.html.twig b/Resources/views/Adress/edit.html.twig deleted file mode 100644 index 16495743b..000000000 --- a/Resources/views/Adress/edit.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 deleted file mode 100644 index d6ac07551..000000000 --- a/Resources/views/Adress/index.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{% 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 deleted file mode 100644 index abe70e67a..000000000 --- a/Resources/views/Adress/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index fe5f79907..000000000 --- a/Resources/views/Adress/show.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{% 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 deleted file mode 100644 index 6ce9b1cb5..000000000 --- a/Resources/views/BlopEntity/edit.html.twig +++ /dev/null @@ -1,22 +0,0 @@ -{% 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 deleted file mode 100644 index 2f80f71a5..000000000 --- a/Resources/views/BlopEntity/index.html.twig +++ /dev/null @@ -1,45 +0,0 @@ -{% 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 deleted file mode 100644 index 9d9d15292..000000000 --- a/Resources/views/BlopEntity/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index da44cbc20..000000000 --- a/Resources/views/BlopEntity/show.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% 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 deleted file mode 100644 index c60322926..000000000 --- a/Resources/views/BlopEntity2/edit.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 deleted file mode 100644 index 61c1175e4..000000000 --- a/Resources/views/BlopEntity2/index.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{% 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 deleted file mode 100644 index df1fbf230..000000000 --- a/Resources/views/BlopEntity2/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index 4f298bef9..000000000 --- a/Resources/views/BlopEntity2/show.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{% extends '::base.html.twig' %} - -{% block body -%} -

BlopEntity2

- - - - - - - - - - - - -
Id{{ entity.id }}
CustomfieldData{{ entity.customFieldData }}
- - -{% endblock %} diff --git a/Resources/views/Entity/edit.html.twig b/Resources/views/Entity/edit.html.twig deleted file mode 100644 index 0376acef2..000000000 --- a/Resources/views/Entity/edit.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 deleted file mode 100644 index 9c9c55093..000000000 --- a/Resources/views/Entity/index.html.twig +++ /dev/null @@ -1,45 +0,0 @@ -{% 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 deleted file mode 100644 index cee1c0b8e..000000000 --- a/Resources/views/Entity/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index 3ed82f14a..000000000 --- a/Resources/views/Entity/show.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% 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 deleted file mode 100644 index 2cac0777d..000000000 --- a/Resources/views/TestEntity/edit.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 deleted file mode 100644 index d5f7e5359..000000000 --- a/Resources/views/TestEntity/index.html.twig +++ /dev/null @@ -1,45 +0,0 @@ -{% 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 deleted file mode 100644 index d17621c81..000000000 --- a/Resources/views/TestEntity/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index d03ebfb22..000000000 --- a/Resources/views/TestEntity/show.html.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% 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 deleted file mode 100644 index 144c0e5a9..000000000 --- a/Resources/views/TestExtraColumn/edit.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{% 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 deleted file mode 100644 index 97c61931e..000000000 --- a/Resources/views/TestExtraColumn/index.html.twig +++ /dev/null @@ -1,41 +0,0 @@ -{% 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 deleted file mode 100644 index 3d79e65e3..000000000 --- a/Resources/views/TestExtraColumn/new.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{% 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 deleted file mode 100644 index 1e1c570a4..000000000 --- a/Resources/views/TestExtraColumn/show.html.twig +++ /dev/null @@ -1,32 +0,0 @@ -{% extends '::base.html.twig' %} - -{% block body -%} -

TestExtraColumn

- - - - - - - - - - - - -
Id{{ entity.id }}
Name{{ entity.name }}
- - -{% endblock %} diff --git a/Tests/Controller/AdressControllerTest_TODO.php b/Tests/Controller/AdressControllerTest_TODO.php deleted file mode 100644 index 7d1a9874f..000000000 --- a/Tests/Controller/AdressControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index 8b5700df2..000000000 --- a/Tests/Controller/BlopEntity2ControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index 47f920de6..000000000 --- a/Tests/Controller/BlopEntityControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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/EntityControllerTest_TODO.php b/Tests/Controller/EntityControllerTest_TODO.php deleted file mode 100644 index 427f13a16..000000000 --- a/Tests/Controller/EntityControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index b6e7d6fe7..000000000 --- a/Tests/Controller/TestEntityControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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 deleted file mode 100644 index e83f5cd9a..000000000 --- a/Tests/Controller/TestExtraColumnControllerTest_TODO.php +++ /dev/null @@ -1,55 +0,0 @@ -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()); - } - - */ -}