Beispiel #1
0
 public function editModelAssumptionAction(Request $request)
 {
     /** @var \Doctrine\ORM\EntityManager $em */
     $em = $this->get('doctrine.orm.entity_manager');
     $model = $em->getRepository('WealthbotAdminBundle:CeModel')->find($request->get('model_id'));
     if (!$model || $model->getOwner()->getRia() != $this->getUser()) {
         return $this->getJsonResponse(array('status' => 'error'));
     }
     $form = $this->createForm(new ModelAssumptionFormType($em), $model);
     if ($request->isMethod('post')) {
         $formHandler = new ModelAssumptionFormHandler($form, $request, $em);
         if ($formHandler->process()) {
             return $this->getJsonResponse(array('status' => 'success', 'redirect_url' => $this->generateUrl('rx_ria_models', array(), true)));
         }
         return $this->getJsonResponse(array('status' => 'error', 'content' => $this->renderView('WealthbotAdminBundle:Model:_third_party_model_edit_model_assumption_form.html.twig', array('form' => $form->createView(), 'action_url' => $this->generateUrl('rx_ria_models_edit_model_assumption', array('model_id' => $model->getId()))))));
     }
     return $this->getJsonResponse(array('status' => 'success', 'content' => $this->renderView('WealthbotAdminBundle:Model:_third_party_model_edit_model_assumption_form.html.twig', array('form' => $form->createView(), 'action_url' => $this->generateUrl('rx_ria_models_edit_model_assumption', array('model_id' => $model->getId()))))));
 }
Beispiel #2
0
 public function editModelAssumptionAction(Request $request)
 {
     $this->checkAccess(Acl::PERMISSION_EDIT);
     /** @var \Doctrine\ORM\EntityManager $em */
     /** @var $modelManager CeModelManager */
     $em = $this->get('doctrine.orm.entity_manager');
     $modelManager = $this->get('wealthbot_admin.ce_model_manager');
     /** @var $parentModel CeModel */
     $parentModel = $modelManager->findCeModelBy(array('id' => $request->get('id')));
     $isShowForecast = true;
     $form = $this->createForm(new ModelAssumptionFormType($isShowForecast), $parentModel);
     if ($request->isMethod('post')) {
         $formHandler = new ModelAssumptionFormHandler($form, $request, $em);
         if ($formHandler->process()) {
             return $this->getJsonResponse(array('status' => 'success', 'redirect_url' => $this->generateUrl('rx_admin_models_index_strategy', array('slug' => $parentModel->getSlug()), true)));
         }
         return $this->getJsonResponse(array('status' => 'error', 'content' => $this->renderView('WealthbotAdminBundle:Model:_third_party_model_edit_model_assumption_form.html.twig', array('form' => $form->createView(), 'action_url' => $this->generateUrl('rx_admin_models_edit_model_assumption', array('id' => $parentModel->getId()))))));
     }
     return $this->getJsonResponse(array('status' => 'success', 'content' => $this->renderView('WealthbotAdminBundle:Model:_third_party_model_edit_model_assumption_form.html.twig', array('form' => $form->createView(), 'action_url' => $this->generateUrl('rx_admin_models_edit_model_assumption', array('id' => $parentModel->getId()))))));
 }