/** * Set defaults * * @param \FileImportHistory $file_import_history */ public function setDefaults($file_import_history) { $schemaObj = $this->getCurrentSchema(); $schemaId = $schemaObj->getId(); if ('Vocabulary' == get_class($schemaObj)) { $file_import_history->setVocabularyId($schemaId); } else { $file_import_history->setSchemaId($schemaId); } $userId = sfContext::getInstance()->getUser()->getSubscriberId(); $file_import_history->setUserId($userId); /** @var sfWebRequest $request */ $request = $this->getRequest(); if ($request->hasFile("file_import_history[filename]") and !$request->hasFileErrors()) { $sourceFile = $request->getFile("file_import_history[filename]"); $file_import_history->setSourceFileName($sourceFile['name']); $file_import_history->setFileType($sourceFile['type']); } parent::setDefaults($file_import_history); }
/** * Method called to associate a FileImportHistory object to this object * through the FileImportHistory foreign key attribute * * @param FileImportHistory $l FileImportHistory * @return void * @throws PropelException */ public function addFileImportHistory(FileImportHistory $l) { $this->collFileImportHistorys[] = $l; $l->setBatch($this); }
public function saveResults($batchId = '') { $batchLog = new \BatchPeer(); if ($batchId) { $criteria = new \Criteria(); $criteria->add(\BatchPeer::ID, $batchId); /** @var $batch \Batch */ $batch = $batchLog::doSelectOne($criteria); } if (empty( $batch )) { $batch = $batchLog->createBatchRecord(time(), "manual import from file", "schema", "manual import (testing)", "import", $this->vocabId, $this->vocabulary->getUri()); } //there's a bunch more stuff we should save here $import = new \FileImportHistory(); $import->setFileName($this->file); $import->setFileType($this->type); //todo $this->mapping isn't correct //$import->setMap($this->mapping); $import->setResults($this->results); $import->setUserId($this->userId); $import->setSchemaId($this->vocabId); $import->setBatch($batch); //$import->setBatch($batch); $import->save(); return $batch->getId(); }
/** * Declares an association between this object and a FileImportHistory object. * * @param FileImportHistory $v * @return void * @throws PropelException */ public function setFileImportHistory($v) { if ($v === null) { $this->setImportId(NULL); } else { $this->setImportId($v->getId()); } $this->aFileImportHistory = $v; }
/** * Method called to associate a FileImportHistory object to this object * through the FileImportHistory foreign key attribute * * @param FileImportHistory $l FileImportHistory * @return void * @throws PropelException */ public function addFileImportHistory(FileImportHistory $l) { $this->collFileImportHistorys[] = $l; $l->setVocabulary($this); }