public function editAction($id = null)
 {
     $repo = $this->getDoctrine()->getManager()->getRepository('IndicadoresBundle:OrigenDatos');
     $this->admin->setRepository($repo);
     $vitacora = $this->get('vitacora.siig');
     $vitacora->addInfo('Se Edito significado de Campo ');
     return parent::editAction($id);
 }
Пример #2
0
 /**
  * @param null $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function editAction($id = null)
 {
     $object = $this->admin->getObject($id);
     if (!$object) {
         return $this->redirect($this->admin->generateUrl('list'));
     }
     return $this->_action(parent::editAction($id), $id);
 }
 public function editAction($id = null)
 {
     if ($this->getRestMethod() == 'POST') {
         $request = $this->container->get('request');
         $this->saveMenuItems($id, $request);
     }
     return parent::editAction($id);
     // TODO: Change the autogenerated stub
 }
 public function editAction($id = NULL)
 {
     $result = parent::editAction($id);
     if ($this->getRestMethod() == 'POST' && $this->admin->getForm()->isValid()) {
         /** @var SeoFile $seo_file */
         $seo_file = $this->admin->getSubject();
         $this->writeFile($seo_file->getName(), $seo_file->getContent());
     }
     return $result;
 }
Пример #5
0
 public function editAction($id = null)
 {
     if ($this->getRestMethod() == 'POST') {
         $object = $this->admin->getObject($id);
         $user = $this->getDoctrine()->getRepository('\\Application\\Sonata\\UserBundle\\Entity\\User')->find($this->getUser()->getId());
         $order = $object->getOrder();
         $object->setCanceledBy($user);
         $this->admin->update($object);
         if ($order) {
             $order->setInvoiceNumber("");
             $this->admin->update($order);
         }
     }
     return parent::editAction($id);
 }
 public function testEditActionWithLockException()
 {
     $object = new \stdClass();
     $class = get_class($object);
     $this->admin->expects($this->any())->method('getObject')->will($this->returnValue($object));
     $this->admin->expects($this->any())->method('isGranted')->with($this->equalTo('EDIT'))->will($this->returnValue(true));
     $this->admin->expects($this->any())->method('getClass')->will($this->returnValue($class));
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $form->expects($this->any())->method('isValid')->will($this->returnValue(true));
     $this->admin->expects($this->any())->method('getForm')->will($this->returnValue($form));
     $form->expects($this->any())->method('isSubmitted')->will($this->returnValue(true));
     $this->request->setMethod('POST');
     $this->admin->expects($this->any())->method('update')->will($this->throwException(new LockException()));
     $this->admin->expects($this->any())->method('toString')->with($this->equalTo($object))->will($this->returnValue($class));
     $formView = $this->getMock('Symfony\\Component\\Form\\FormView');
     $form->expects($this->any())->method('createView')->will($this->returnValue($formView));
     $this->expectTranslate('flash_lock_error', array('%name%' => $class, '%link_start%' => '<a href="stdClass_edit">', '%link_end%' => '</a>'), 'SonataAdminBundle');
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $this->controller->editAction(null, $this->request));
 }
Пример #7
0
 public function testEditActionWithPreview()
 {
     $object = new \stdClass();
     $this->admin->expects($this->once())->method('getObject')->will($this->returnValue($object));
     $this->admin->expects($this->once())->method('isGranted')->with($this->equalTo('EDIT'))->will($this->returnValue(true));
     $form = $this->getMockBuilder('Symfony\\Component\\Form\\Form')->disableOriginalConstructor()->getMock();
     $this->admin->expects($this->once())->method('getForm')->will($this->returnValue($form));
     $this->admin->expects($this->once())->method('supportsPreviewMode')->will($this->returnValue(true));
     $formView = $this->getMock('Symfony\\Component\\Form\\FormView');
     $form->expects($this->any())->method('createView')->will($this->returnValue($formView));
     $form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $this->request->setMethod('POST');
     $this->request->request->set('btn_preview', 'Preview');
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $this->controller->editAction());
     $this->assertSame($this->admin, $this->parameters['admin']);
     $this->assertSame('SonataAdminBundle::standard_layout.html.twig', $this->parameters['base_template']);
     $this->assertSame($this->pool, $this->parameters['admin_pool']);
     $this->assertSame('edit', $this->parameters['action']);
     $this->assertInstanceOf('Symfony\\Component\\Form\\FormView', $this->parameters['form']);
     $this->assertSame($object, $this->parameters['object']);
     $this->assertSame(array(), $this->session->getFlashBag()->all());
     $this->assertSame('SonataAdminBundle:CRUD:preview.html.twig', $this->template);
 }
 public function editAction($id = null)
 {
     $repo = $this->getDoctrine()->getEntityManager()->getRepository('IndicadoresBundle:OrigenDatos');
     $this->admin->setRepository($repo);
     return parent::editAction($id);
 }
 /**
  * @param null $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function editAction($id = null)
 {
     return $this->_action(parent::editAction(), 'edit');
 }
 /**
  * @param null $id
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function editAction($id = null)
 {
     $this->getObjectMonthYear();
     //$this->getLocking();
     if ($this->get('request')->getMethod() == 'POST') {
         $id = $this->get('request')->get($this->admin->getIdParameter());
         if ($this->admin->isObjectLocked($id)) {
             $this->getLockingAccessDenied();
         }
     }
     $action = $this->_action(parent::editAction(), 'edit', 'form_layout');
     return $action;
 }
 public function editAction($id = null)
 {
     return parent::editAction($id);
     // TODO: Change the autogenerated stub
 }
 public function editAction($id = null)
 {
     $repo = $this->getDoctrine()->getManager()->getRepository('IndicadoresBundle:FichaTecnica');
     $this->admin->setRepository($repo);
     return parent::editAction($id);
 }