/** * @Route("/create/{entityClass}/{entityId}", name="oro_note_create") * * @Template("OroNoteBundle:Note:update.html.twig") * @AclAncestor("oro_note_create") */ public function createAction($entityClass, $entityId) { $entityRoutingHelper = $this->getEntityRoutingHelper(); $entity = $entityRoutingHelper->getEntity($entityClass, $entityId); $entityClass = ClassUtils::getRealClass($entity); $noteEntity = new Note(); $noteEntity->setTarget($entity); $formAction = $entityRoutingHelper->generateUrlByRequest('oro_note_create', $this->getRequest(), $entityRoutingHelper->getRouteParameters($entityClass, $entityId)); return $this->update($noteEntity, $formAction); }
/** * @Route("/create/{entityClass}/{entityId}", name="oro_note_create") * * @Template("OroNoteBundle:Note:update.html.twig") * @AclAncestor("oro_note_create") */ public function createAction($entityClass, $entityId) { $entityRoutingHelper = $this->getEntityRoutingHelper(); $entity = $entityRoutingHelper->getEntity($entityClass, $entityId); $entityClass = get_class($entity); $noteEntity = new Note(); $noteEntity->setTarget($entity); $formAction = $entityRoutingHelper->generateUrl('oro_note_create', $entityClass, $entityId); return $this->update($noteEntity, $formAction); }
/** * "Success" form handler * * @param RFPRequest $rfpRequest */ protected function onSuccess(RFPRequest $rfpRequest) { $status = $this->form->get('status')->getData(); $noteMessage = trim($this->form->get('note')->getData()); $rfpRequest->setStatus($status); if (!empty($noteMessage)) { $note = new Note(); $note->setTarget($rfpRequest)->setMessage(htmlspecialchars_decode($this->templating->render('OroB2BRFPBundle:Request:note.html.twig', ['status' => $status->getLabel(), 'note' => $noteMessage]))); $this->manager->persist($note); } $this->manager->flush(); }