/**
  * 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();
    }