/**
  * @param Registry $doctrine
  * @param Session $session
  * @param Logger $logger
  * @param Parameters $parameters
  */
 public function __construct(Registry $doctrine, Session $session, Logger $logger, Parameters $parameters)
 {
     $this->doctrine = $doctrine;
     $this->session = $session;
     $this->logger = $logger;
     $this->parameters = $parameters;
     $fromRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerFrom());
     $fromRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
     $fromMassRetriever = new PgMassRetriever($doctrine, $this->logger, $this->parameters->getManagerFrom());
     $toRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerTo());
     $toRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
     $toMassRetriever = new PgMassRetriever($doctrine, $this->logger, $this->parameters->getManagerTo());
     $this->fromAnalyzer = new PgAnalyzer($this->logger, $fromRetriever, $fromMassRetriever);
     $this->toAnalyzer = new PgAnalyzer($this->logger, $toRetriever, $toMassRetriever);
     if ($this->session->has(SyncHandler::SESSION_FROM_KEY)) {
         $this->fromAnalyzer->setSchemas($this->session->get(SyncHandler::SESSION_FROM_KEY));
         $this->fromAnalyzer->initTables();
     } else {
         $this->fromAnalyzer->initSchemas();
         $this->fromAnalyzer->initSchemasElements();
         $this->fromAnalyzer->initCompareTableInfo();
         //$this->session->set(SyncHandler::SESSION_FROM_KEY, $this->fromAnalyzer->getSchemas());
     }
     if ($this->session->has(SyncHandler::SESSION_TO_KEY)) {
         $this->toAnalyzer->setSchemas($this->session->get(SyncHandler::SESSION_TO_KEY));
         $this->toAnalyzer->initTables();
     } else {
         $this->toAnalyzer->initSchemas();
         $this->toAnalyzer->initSchemasElements();
         $this->toAnalyzer->initCompareTableInfo();
         $this->toAnalyzer->initTables();
         //$this->session->set(SyncHandler::SESSION_TO_KEY, $this->toAnalyzer->getSchemas());
     }
 }
Beispiel #2
0
 public function __construct(Registry $doctrine, Session $session, Logger $logger, Parameters $parameters)
 {
     $this->doctrine = $doctrine;
     $this->session = $session;
     $this->logger = $logger;
     $this->parameters = $parameters;
     $this->emFrom = $this->doctrine->getManager($this->parameters->getManagerFrom());
     $this->emTo = $this->doctrine->getManager($this->parameters->getManagerTo());
     $fromRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerFrom());
     $fromRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
     //$toRetriever = new PgRetriever($doctrine, $this->logger, $this->parameters->getManagerTo() );
     //$toRetriever->setIndexType(PgRetriever::INDEX_TYPE_NAME);
     $this->fromAnalyzer = new PgAnalyzer($this->logger, $fromRetriever);
     //$this->toAnalyzer = new PgAnalyzer($this->logger, $toRetriever);
     if ($this->session->has(CompareStructure::SESSION_FROM_KEY)) {
         $this->fromAnalyzer->setSchemas($this->session->get(CompareStructure::SESSION_FROM_KEY));
         $this->fromAnalyzer->initTables();
     } else {
         throw new SyncException('No source data');
     }
     /*if($this->session->has(CompareStructure::SESSION_TO_KEY)){
           $this->toAnalyzer->setSchemas($this->session->get(CompareStructure::SESSION_TO_KEY));
           $this->toAnalyzer->initTables();
       }else{
           throw new SyncException('No targeted data');
       }*/
 }