Example #1
0
 /**
  * Creates a new configuration instance and serializes
  *
  * @param string $configurationIdentifier Configuration identifier
  * @param string $configurationNamespace  Configuration namespace
  * @param string $configurationKey        Configuration key
  * @param mixed  $configurationValue      Configuration value
  *
  * @return ConfigurationInterface New Configuration created
  *
  * @throws ConfigurationParameterNotFoundException Configuration parameter not found
  */
 private function createConfigurationInstance($configurationIdentifier, $configurationNamespace, $configurationKey, $configurationValue)
 {
     /**
      * Value is not found on database. We can just check if the value is
      * defined in the configuration elements, and we can generate new entry
      * for our database
      */
     if (!$this->configurationElements[$configurationIdentifier]) {
         throw new ConfigurationParameterNotFoundException();
     }
     $configurationType = $this->configurationElements[$configurationIdentifier]['type'];
     $configurationValue = $this->serializeValue($configurationValue, $configurationType);
     $configurationEntity = $this->configurationFactory->create()->setKey($configurationKey)->setNamespace($configurationNamespace)->setName($this->configurationElements[$configurationIdentifier]['name'])->setType($configurationType)->setValue($configurationValue);
     return $configurationEntity;
 }
 public function create()
 {
     $configuration = parent::create();
     $configuration->enable()->setPosition(1);
     return $configuration;
 }