Example #1
0
 /**
  * Select configurations from database
  *
  * @param ConfigGetterWrapper $configGetterWrapper
  * @param number $channel
  * @param number $languageId
  */
 public function setupConfigurations(ConfigGetterWrapper $wrapper, array $input)
 {
     if (!is_object($this->recoverService('routeMatch'))) {
         throw new \Exception("RouteMatch is not set");
     }
     $wrapper->setInput(array('channel' => isset($input['channel']) ? $input['channel'] : 1, 'language' => isset($input['languageId']) ? $input['languageId'] : 1, 'isBackend' => $this->recoverService('isBackend'), 'languageAbbreviation' => isset($input['languageAbbreviation']) ? $input['languageAbbreviation'] : null));
     $wrapper->setupQueryBuilder();
     $configurations = $wrapper->formatNameAndValue($wrapper->getRecords());
     $configurations['routeMatchName'] = $this->recoverService('routeMatch')->getMatchedRouteName();
     $this->setService('configurations', $configurations);
     return $configurations;
 }
 public function indexAction()
 {
     $mainLayout = $this->initializeAdminArea();
     $em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
     $configurations = $this->layout()->getVariable('configurations');
     $userDetails = $this->recoverUserDetails();
     $wrapper = new ConfigGetterWrapper(new ConfigGetter($em));
     $wrapper->setInput(array('languageAbbreviation' => ''));
     $wrapper->setupQueryBuilder();
     $form = new ConfigForm();
     $form->addMainConfigs();
     if ($userDetails->role == 'WebMaster') {
         $form->addTemplates();
         $form->addProject();
         $form->addAmazonS3Fields();
         $form->addPasswordPreviewArea();
     }
     $form->setData($configurations);
     $this->layout()->setVariables(array('form' => $form, 'formAction' => '#', 'formTitle' => 'Configurazioni', 'formDescription' => 'Opzioni principali applicazione.', 'templatePartial' => self::formTemplate));
     $this->layout()->setTemplate($mainLayout);
 }
Example #3
0
 /**
  * @return mixed
  * @throws \Exception
  */
 private function recoverSitename($sl)
 {
     $configGetterWrapper = new ConfigGetterWrapper(new ConfigGetter($sl->get('doctrine.entitymanager.orm_default')));
     $configGetterWrapper->setInput(array('name' => 'sitename', 'channel' => 1, 'language' => 1, 'limit' => 1));
     $configGetterWrapper->setupQueryBuilder();
     $records = $configGetterWrapper->getRecords();
     if (empty($records)) {
         throw new \Exception("Errore: nome sito non rilevato fra le configurazioni");
     }
     return $records[0]['value'];
 }
 public function testSetupQueryBuilder()
 {
     $this->assertNull($this->objectWrapper->setupQueryBuilder());
 }