public function testDelete() { $em = $this->em; $entity = new PublisherDesign(); $entity->setTitle('Publisher Design Delete Title'); $entity->setContent('content'); $entity->setEditableContent('editable'); $entity->setPublic(false); $publisher = $em->getRepository('OjsJournalBundle:Publisher')->find(1); $entity->setPublisher($publisher); $em->persist($entity); $em->flush(); $id = $entity->getId(); $this->logIn(); $client = $this->client; $token = $this->generateToken('ojs_admin_publisher_design' . $id); $client->request('DELETE', '/admin/publisher-design/' . $id . '/delete', array('_token' => $token)); $this->assertStatusCode(302, $client); }
/** * Displays a form to edit an existing PublisherDesign entity. * * @param integer $publisherId * @param PublisherDesign $entity * @return Response */ public function editAction($publisherId, PublisherDesign $entity) { $em = $this->getDoctrine()->getManager(); $publisher = $em->getRepository('OjsJournalBundle:Publisher')->find($publisherId); $this->throw404IfNotFound($publisher); if (!$this->isGrantedForPublisher($publisher)) { throw new AccessDeniedException("You are not authorized for this page!"); } $entity->setEditableContent($this->prepareEditContent($entity->getEditableContent())); $editForm = $this->createEditForm($entity, $publisher); return $this->render('OjsJournalBundle:ManagerPublisherDesign:edit.html.twig', array('entity' => $entity, 'publisher' => $publisher, 'edit_form' => $editForm->createView())); }