コード例 #1
0
 /**
  * Synchronize entities from config file
  * @param array $entity_names
  */
 public function synchronize(array $entity_names)
 {
     $entities = $this->setup->getMappedSyncEntities($entity_names);
     foreach ($entities as $name => $entity) {
         /**
          * @var OpenstoreAkilia\Sync\Entities\AbstractEntity $cls
          */
         $cls = $entity['class'];
         $syncEntity = new $cls($this->dbExecuter, $this->setup);
         $syncEntity->setLegacySynchroAt($this->legacy_synchro_at);
         $syncEntity->synchronize();
     }
 }
コード例 #2
0
 protected function loadConfiguration()
 {
     $this->legacy_synchro_at = date('Y-m-d H:i:s');
     $this->akilia2Db = $this->setup->getSynchronizerConfig('db_akilia2');
     $this->openstoreDb = $this->setup->getDatabaseAdapter()->getCurrentSchema();
     $this->akilia1Db = $this->setup->getSynchronizerConfig('db_akilia1');
     $this->intelaccessDb = $this->setup->getSynchronizerConfig('db_intelaccess');
     $this->akilia1lang = $this->setup->getSynchronizerConfig('akilia1_language_map');
     $this->default_language = $this->setup->getSynchronizerConfig('default_language');
     $this->default_language_sfx = $this->akilia1lang[$this->default_language];
 }
コード例 #3
0
 /**
  * @covers OpenstoreAkilia\Config\OpenstoreAkiliaSetup::getDatabaseAdapter
  */
 public function testGetDatabaseAdapter()
 {
     $adapter = $this->setup->getDatabaseAdapter();
     $this->assertInstanceOf('Zend\\Db\\Adapter\\Adapter', $adapter);
 }
コード例 #4
0
    $directories = [getcwd() . DIRECTORY_SEPARATOR . 'config', DIRNAME(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'config'];
    $configFound = false;
    $configFile = null;
    foreach ($directories as $directory) {
        $configFile = $directory . DIRECTORY_SEPARATOR . 'openstore-akilia.config.php';
        if (file_exists($configFile)) {
            $configFound = true;
            break;
        }
    }
    if (!$found) {
        throw new \Exception("Cannot find configuration file '{$configFile}'");
    }
    $ds = DIRECTORY_SEPARATOR;
    $defaultEntitiesFile = __DIR__ . "{$ds}..{$ds}config{$ds}openstore-akilia-standard-sync-entities.config.php";
    $setup = OpenstoreAkiliaSetup::loadFromFiles([$defaultEntitiesFile, $configFile]);
} catch (\Exception $e) {
    echo $e->getMessage() . "\n";
    exit(1);
}
$cli = new Symfony\Component\Console\Application('openstore-schema-core console', '1.0.0');
$cli->setCatchExceptions(true);
// commands
$commandRepository = new CommandRepository();
$cli->addCommands($commandRepository->getRegisteredCommands());
// helpers
$helpers = ['openstore-akilia-setup' => new OpenstoreAkilia\Console\Helper\ConfigurationHelper($setup), 'question' => new Symfony\Component\Console\Helper\QuestionHelper()];
foreach ($helpers as $name => $helper) {
    $cli->getHelperSet()->set($helper, $name);
}
$cli->run();