/**
  * Runs the initial set up of the processing system
  */
 public function runAction()
 {
     try {
         $this->commandBus->dispatch(CreateDefaultProcessingConfigFile::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
         $sqliteDbFile = SqliteDbFile::initializeFromDist(Definition::getEventStoreSqliteDbFile());
         $esConfigLocation = ConfigLocation::fromPath(Definition::getSystemConfigDir());
         $this->commandBus->dispatch(InitializeEventStore::setUpWithSqliteDbAdapter($sqliteDbFile, $esConfigLocation));
     } catch (\Exception $ex) {
         $this->commandBus->dispatch(UndoSystemSetUp::removeConfigs(Definition::getSystemConfigDir(), Definition::getSystemConfigDir(), Definition::getEventStoreSqliteDbFile()));
         throw $ex;
     }
     return $this->redirect()->toRoute('prooph.link/system_config');
 }
 /**
  * Handles a POST request to enable or disable the workflow processor message queue
  */
 public function configureWorkflowProcessorMessageQueueAction()
 {
     $queueEnabled = $this->bodyParam('enabled');
     if (!is_bool($queueEnabled)) {
         return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag should be a boolean value')));
     }
     if ($queueEnabled) {
         $this->commandBus->dispatch(EnableWorkflowProcessorMessageQueue::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
     } else {
         $this->commandBus->dispatch(DisableWorkflowProcessorMessageQueue::in(ConfigLocation::fromPath(Definition::getSystemConfigDir())));
     }
     return ['success' => true];
 }
 protected function setUp()
 {
     $this->connection = DbalConnection::fromConfiguration(['driver' => 'pdo_sqlite', 'memory' => true, 'dbname' => 'test_db']);
     $testDataTable = new Table("test_data");
     $testDataTable->addColumn("name", "string");
     $testDataTable->addColumn("age", "integer");
     $testDataTable->addColumn("created_at", "datetime");
     $testDataTable->addColumn("price", "float");
     $testDataTable->addColumn("active", "boolean");
     $testDataTable->setPrimaryKey(["name"]);
     $this->connection->connection()->getSchemaManager()->createTable($testDataTable);
     $this->dataTypeLocation = ApplicationDataTypeLocation::fromPath(sys_get_temp_dir());
     $this->commandBus = new CommandBusMock();
     if (!is_dir(sys_get_temp_dir() . "/SqlConnector")) {
         mkdir(sys_get_temp_dir() . "/SqlConnector");
         mkdir(sys_get_temp_dir() . "/SqlConnector/DataType");
     }
     $connections = new DbalConnectionCollection();
     $connections->add($this->connection);
     $this->tableConnectorGenerator = new TableConnectorGenerator($connections, $this->dataTypeLocation, ConfigLocation::fromPath(sys_get_temp_dir()), $this->commandBus, Bootstrap::getServiceManager()->get("config")['prooph.link.sqlconnector']['doctrine_processing_type_map']);
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     return ConfigLocation::fromPath($serviceLocator->get('config')['system_config_dir']);
 }
Exemplo n.º 5
0
 /**
  * @return ConfigLocation
  */
 public function configLocation()
 {
     return ConfigLocation::fromPath($this->payload['config_location']);
 }