예제 #1
0
 public function testAllFieldsNull()
 {
     $this->assertNull($this->data->getContent());
     $this->assertNull($this->data->getCreated());
     $this->assertNull($this->data->getId());
     $this->assertNull($this->data->getIdentifier());
     $this->assertNull($this->data->getLocale());
     $this->assertNull($this->data->getModified());
 }
예제 #2
0
 /**
  * Displays a form to edit an existing I18n entity.
  *
  * @Route("/{id}/edit", name="i18n_edit")
  * @Method({"GET", "POST"})
  */
 public function editAction(Request $request, I18n $i18n)
 {
     //         $deleteForm = $this->createDeleteForm($i18n);
     if (empty($i18n->getContent())) {
         $i18n->setContent([['locale' => '', 'text' => '']]);
     }
     $editForm = $this->createForm(I18nType::class, $i18n);
     $editForm->handleRequest($request);
     if ($editForm->isSubmitted() && $editForm->isValid()) {
         $em = $this->getDoctrine()->getManager();
         //renumber array elements
         $i18n->setContent(array_values($i18n->getContent()));
         $em->persist($i18n);
         $em->flush();
         return $this->redirectToRoute('i18n_index');
     }
     return $this->render('i18n/edit.html.twig', array('i18n' => $i18n, 'edit_form' => $editForm->createView()));
 }