public function save($data)
 {
     $transaction = $this->beginTransaction();
     try {
         if ($this->isPersistent()) {
             $this->setActive(true);
         } else {
             $schema = new Construction($data->idConstruction);
             $entity = new Entity();
             $entity->setAlias($this->getEntry());
             $entity->setType('CE');
             $entity->save();
             $entry = new Entry();
             $entry->newEntry($this->getEntry());
             Base::createEntityRelation($entity->getId(), 'rel_elementof', $schema->getIdEntity());
             $this->setIdEntity($entity->getId());
             $this->setActive(true);
         }
         parent::save();
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollback();
         throw new \Exception($e->getMessage());
     }
 }
Ejemplo n.º 2
0
 public function formImportTxt()
 {
     $model = new Construction($this->data->id);
     $this->data->cxn = $model->getEntry() . '  [' . $model->getName() . ']';
     $this->data->languages = Base::languages();
     $this->data->message = _M("Importação de arquivo de texto simples (uma sentença por linha).");
     $this->data->save = "@fnbr20/structure/cxn/importTxt|formImportTxt";
     $this->data->close = "!\$('#formImportTxt_dialog').dialog('close')";
     $this->render();
 }
 public function addManualSubCorpusCxn($data)
 {
     $transaction = $this->beginTransaction();
     try {
         $entity = Base::createEntity('SC', 'sco_manually-added');
         $this->setName('manually-added');
         $this->setRank(0);
         $this->setIdEntity($entity->getId());
         $this->save();
         $cxn = Construction::create($data->idConstruction);
         Base::createEntityRelation($cxn->getIdEntity(), 'rel_hassubcorpus', $this->getIdEntity());
         $annotationSet = new AnnotationSet();
         $annotationSet->setIdSubCorpus($this->getId());
         $annotationSet->setIdSentence($data->idSentence);
         $annotationSet->setIdAnnotationStatus('ast_manual');
         $annotationSet->save();
         $annotationSet->createLayersForCxn($cxn, $data);
         $transaction->commit();
     } catch (\Exception $ex) {
         $transaction->rollback();
         throw new \Exception($ex->getMessage());
     }
 }