Exemplo n.º 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;
 }
Exemplo n.º 2
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'];
 }