/**
  * Set the current configuration
  *
  * @AclAncestor("oro_config_system")
  *
  * @return JsonResponse
  */
 public function postAction(Request $request)
 {
     $this->configManager->save(json_decode($request->getContent(), true));
     $data = json_decode($request->getContent(), true);
     file_put_contents($this->getMessagesFilePath(), $data['pim_ui___loading_messages']['value']);
     return $this->getAction();
 }
Esempio n. 2
0
 public function testSave()
 {
     $data = [];
     $this->userScopeManager->expects($this->once())->method('save')->with($data)->willReturn([[], []]);
     $this->dispatcher->expects($this->once())->method('dispatch');
     $this->userScopeManager->expects($this->once())->method('reload');
     $this->manager->save($data);
 }
Esempio n. 3
0
 public function testSave()
 {
     $data = [];
     $this->userScopeManager->expects($this->once())->method('save')->with($data)->willReturn([[], []]);
     $this->dispatcher->expects($this->exactly(2))->method('dispatch');
     $this->dispatcher->expects($this->at(0))->method('dispatch')->with(ConfigSettingsUpdateEvent::BEFORE_SAVE, $this->isInstanceOf('Oro\\Bundle\\ConfigBundle\\Event\\ConfigSettingsUpdateEvent'));
     $this->dispatcher->expects($this->at(1))->method('dispatch')->with(ConfigUpdateEvent::EVENT_NAME, $this->isInstanceOf('Oro\\Bundle\\ConfigBundle\\Event\\ConfigUpdateEvent'));
     $this->userScopeManager->expects($this->once())->method('reload');
     $this->userScopeManager->expects($this->once())->method('save')->with($data);
     $this->manager->save($data);
 }
Esempio n. 4
0
 /**
  * Process form
  *
  * @param FormInterface $form
  *
  * @param Request $request
  * @return bool True on successful processing, false otherwise
  */
 public function process(FormInterface $form, Request $request)
 {
     $settingsData = $this->manager->getSettingsByForm($form);
     $form->setData($settingsData);
     if (in_array($request->getMethod(), array('POST', 'PUT'))) {
         $form->submit($request);
         if ($form->isValid()) {
             $this->manager->save($form->getData());
             return true;
         }
     }
     return false;
 }
Esempio n. 5
0
 public function testSave()
 {
     $data = ['oro_user___greeting' => ['value' => 'updated value', 'use_parent_scope_value' => false], 'oro_user___unknown' => ['value' => 'some value', 'use_parent_scope_value' => false], 'oro_user___level' => ['use_parent_scope_value' => true]];
     $normalizedData = ['oro_user.greeting' => ['value' => 'updated value', 'use_parent_scope_value' => false], 'oro_user.level' => ['use_parent_scope_value' => true]];
     $this->userScopeManager->expects($this->exactly(2))->method('getSettingValue')->willReturnMap([['oro_user.greeting', false, 'old value'], ['oro_user.level', false, 2000]]);
     $beforeEvent = new ConfigSettingsUpdateEvent($this->manager, $normalizedData);
     $afterEvent = new ConfigUpdateEvent(['oro_user.greeting' => ['old' => 'old value', 'new' => 'updated value'], 'oro_user.level' => ['old' => 2000, 'new' => 20]]);
     $this->userScopeManager->expects($this->once())->method('save')->with($normalizedData)->willReturn([['oro_user.greeting' => 'updated value'], ['oro_user.level']]);
     $this->dispatcher->expects($this->exactly(2))->method('dispatch');
     $this->dispatcher->expects($this->at(0))->method('dispatch')->with(ConfigSettingsUpdateEvent::BEFORE_SAVE, $beforeEvent);
     $this->dispatcher->expects($this->at(1))->method('dispatch')->with(ConfigUpdateEvent::EVENT_NAME, $afterEvent);
     $this->manager->save($data);
 }
 /**
  * Set the current configuration
  *
  * @AclAncestor("oro_config_system")
  *
  * @return JsonResponse
  */
 public function postAction(Request $request)
 {
     $this->configManager->save(json_decode($request->getContent(), true));
     return $this->getAction();
 }