public function storeEntityConfiguration(EntityConfiguration $configuration) : bool
 {
     $entity = $configuration->getName();
     $data = $configuration->getArrayCopy();
     $result = $this->getCollection()->updateOne(['entity' => $entity], $data);
     return $result->getModifiedCount() === 1;
 }
示例#2
0
 /**
  * Store configuration for the entity
  *
  * @param EntityConfiguration $configuration Configuration
  * @return bool Success
  * @throws Exception
  */
 public function storeEntityConfiguration(EntityConfiguration $configuration) : bool
 {
     $path = $this->getPath();
     if (is_writable($path)) {
         $configuration_file = sprintf('%s/%s.php', $path, $configuration->getName());
         $result = file_put_contents($configuration_file, '<?php return ' . var_export($configuration->getArrayCopy(), true) . ';' . PHP_EOL);
         return $result > 0;
     } else {
         throw new Exception(sprintf('Configuration path %s is not writable.', $path));
     }
 }