コード例 #1
0
 /**
  * @param Collection $collection
  * @return $this
  * @throws \Exception
  */
 public function setCollection(Collection $collection)
 {
     $this->collection = $collection;
     $this->collectionCode = $collection->getCollectioncode();
     if (is_null($this->collection)) {
         throw new \Exception('Can\'t found the collection with collectionCode = ' . $this->collectionCode);
     } else {
         $this->diffHandler = new DiffHandler($this->user->getDataDirPath(), $this->collection, $this->userGroup);
         //if (!$this->getDiffHandler()->shouldSearchDiffs()) {
         $this->selectedSpecimensHandler = new SelectedSpecimensHandler($this->diffHandler->getCollectionPath(), $this->userGroup);
         $data = $this->getDiffHandler()->getDiffsFile()->getData();
         $data['selectedSpecimens'] = $this->selectedSpecimensHandler->getData();
         $this->sessionHandler = new SessionHandler($this->sessionManager, $this->genericEntityManager, $data);
         $this->getSessionHandler()->init($this->getDiffHandler(), $this->collectionCode);
         //}
     }
     return $this;
 }
コード例 #2
0
 /**
  * @param DiffManager $diffManager
  * @param DiffHandler $diffHandler
  * @return array
  */
 private function createCatalogNumbersFiles(DiffManager $diffManager, DiffHandler $diffHandler)
 {
     $catalogNumbersFiles = [];
     $fs = new Filesystem();
     $this->log('CatalogNumbers');
     foreach ($diffManager::ENTITIES_NAME as $entityName) {
         $catalogNumbers = $diffManager->getResultByClassName($entityName);
         $this->log("\t" . $entityName . ' : ' . count($catalogNumbers));
         $catalogNumbersFilename = $diffHandler->getCollectionPath() . '/catalogNumbers_' . $entityName . '.json';
         $fs->dumpFile($catalogNumbersFilename, \json_encode($catalogNumbers));
         $catalogNumbersFiles[] = $catalogNumbersFilename;
     }
     return $catalogNumbersFiles;
 }