/** * Method called to associate a ConceptPropertyHistory object to this object * through the ConceptPropertyHistory foreign key attribute * * @param ConceptPropertyHistory $l ConceptPropertyHistory * @return void * @throws PropelException */ public function addConceptPropertyHistory(ConceptPropertyHistory $l) { $this->collConceptPropertyHistorys[] = $l; $l->setSkosProperty($this); }
/** * wraps the save function to update concept first * adds history function * * Stores the object in the database. If the object is new, * it inserts it; otherwise an update is performed. This method * wraps the doSave() worker method in a transaction. * * @param Connection $con * @return int The number of rows affected by this insert/update and any referring fk objects' save() operations. * @throws PropelException * @see doSave() */ public function save($con = null) { $concept = $this->getConceptRelatedByConceptId(); $userId = sfContext::getInstance()->getUser()->getSubscriberId(); if ($userId) { $this->setUpdatedUserId($userId); } if ($concept) { if ($userId) { $concept->setUpdatedUserId($userId); } //check to see if the primary pref label flag is set if ($this->primary_pref_label) { //if set, then update the associated concept fields $concept->setPrefLabel($this->getObject()); $concept->setStatusId($this->getStatusId()); $concept->setLanguage($this->getLanguage()); } $vocabularyId = $concept->getVocabularyId(); } if ($this->isModified()) { if ($this->isNew()) { $action = 'added'; } elseif ($this->isDeleted()) { $action = 'force_deleted'; } else { $action = 'updated'; } } else { $action = 'added'; } //continue with save parent::save(); //do the history $history = new ConceptPropertyHistory(); if ($action == 'updated' && $this->getDeletedAt()) { $action = 'deleted'; } $history->setAction($action); $history->setVocabularyId($vocabularyId); $history->setConceptId($this->getConceptId()); $history->setConceptPropertyId($this->getId()); $history->setSkosPropertyId($this->getSkosPropertyId()); $history->setObject($this->getObject()); $history->setSchemeId($this->getSchemeId()); $history->setRelatedConceptId($this->getRelatedConceptId()); $history->setLanguage($this->getLanguage()); $history->setStatusId($this->getStatusId()); $history->setCreatedUserId($this->getUpdatedUserId()); $history->setCreatedAt($this->getUpdatedAt()); if (!empty($this->importId)) { $history->setImportId($this->importId); } $history->save(); }
/** * Method called to associate a ConceptPropertyHistory object to this object * through the ConceptPropertyHistory foreign key attribute * * @param ConceptPropertyHistory $l ConceptPropertyHistory * @return void * @throws PropelException */ public function addConceptPropertyHistoryRelatedByRelatedConceptId(ConceptPropertyHistory $l) { $this->collConceptPropertyHistorysRelatedByRelatedConceptId[] = $l; $l->setConceptRelatedByRelatedConceptId($this); }
/** * Method called to associate a ConceptPropertyHistory object to this object * through the ConceptPropertyHistory foreign key attribute * * @param ConceptPropertyHistory $l ConceptPropertyHistory * @return void * @throws PropelException */ public function addConceptPropertyHistoryRelatedBySchemeId(ConceptPropertyHistory $l) { $this->collConceptPropertyHistorysRelatedBySchemeId[] = $l; $l->setVocabularyRelatedBySchemeId($this); }