/**
  * Return the website configuration parameter value
  */
 public function getParameter(\Twig_Environment $environment, $parameterName, $configAlias = null, $debug = false)
 {
     $defaultConfig = $this->configManager->getRepository()->getDefaultConfiguration();
     $this->config = count($defaultConfig) > 0 ? $defaultConfig[0] : null;
     $parameters = array();
     if ($configAlias === null && $this->config !== null) {
         $params = $this->config->getParameters();
     } elseif ($this->config !== null) {
         $config = $this->configManager->getRepository()->findOneBy(array('alias' => $configAlias));
         if ($config === null) {
             throw new \Exception(sprintf('The configuration with name "%s" not found.', $configAlias));
         }
         $params = $config->getParameters();
     }
     if (!isset($params)) {
         return;
     }
     foreach ($params as $p) {
         $parameters[$p->getName()] = $p->getValue();
     }
     if ($debug === true && !isset($parameters[$parameterName])) {
         throw new \Exception(sprintf('The parameter with name "%s" not found.', $parameterName));
     }
     return isset($parameters[$parameterName]) ? $parameters[$parameterName] : '';
 }
 /**
  * (non-PHPdoc)
  * @see \Symfony\Component\Form\DataTransformerInterface::reverseTransform()
  */
 public function reverseTransform($id)
 {
     $config = $this->configManager->getRepository()->findOneBy(array('id' => $id));
     return $config;
 }
 /**
  * {@inheritDoc}
  * @see \Symfony\Component\Form\AbstractType::configureOptions()
  */
 public function configureOptions(OptionsResolver $resolver)
 {
     $resolver->setDefaults(array('data_class' => $this->parameterManager->getClassName(), 'translation_domain' => 'asf_website'));
 }