/**
  * Method called to associate a SchemaPropertyElementHistory object to this object
  * through the SchemaPropertyElementHistory foreign key attribute
  *
  * @param      SchemaPropertyElementHistory $l SchemaPropertyElementHistory
  * @return     void
  * @throws     PropelException
  */
 public function addSchemaPropertyElementHistoryRelatedByRelatedSchemaPropertyId(SchemaPropertyElementHistory $l)
 {
     $this->collSchemaPropertyElementHistorysRelatedByRelatedSchemaPropertyId[] = $l;
     $l->setSchemaPropertyRelatedByRelatedSchemaPropertyId($this);
 }
 /**
  * description
  *
  * @return integer
  *
  * @param Connection $con
  *
  * @throws Exception
  * @throws PropelException
  */
 public function save($con = null)
 {
     if ($this->isModified()) {
         if ($this->isNew()) {
             $action = 'added';
         } elseif ($this->isDeleted()) {
             $action = 'force_deleted';
         } else {
             $action = 'updated';
         }
         //$property = $this->getSchemaPropertyRelatedBySchemaPropertyId();
         //$property->setUpdatedAt($this->getUpdatedAt());
         $doHistory = true;
         if (count($this->modifiedColumns) == 1 and $this->modifiedColumns[0] == 'reg_schema_property_element.RELATED_SCHEMA_PROPERTY_ID') {
             $doHistory = false;
         }
         //continue with save
         $affectedRows = parent::save($con);
         $userId = $this->getUpdatedUserId();
         //update the schema
         $schema = $this->getSchemaPropertyRelatedBySchemaPropertyId();
         $schemaId = $schema->getSchemaId();
         $schema->setUpdatedAt($this->getUpdatedAt());
         $schema->setUpdatedUserId($userId);
         $schema->save();
         if ($doHistory) {
             //do the history
             $history = new SchemaPropertyElementHistory();
             if ($action == 'updated' && $this->getDeletedAt()) {
                 $action = 'deleted';
             }
             if ($this->getIsGenerated()) {
                 $action = 'generated';
             }
             $history->setAction($action);
             $history->setProfilePropertyId($this->getProfilePropertyId());
             $history->setSchemaId($schemaId);
             $history->setSchemaPropertyId($this->getSchemaPropertyId());
             $history->setSchemaPropertyElementId($this->getId());
             $history->setRelatedSchemaPropertyId($this->getRelatedSchemaPropertyId());
             $history->setObject($this->getObject());
             $history->setLanguage($this->getLanguage());
             $history->setStatusId($this->getStatusId());
             $history->setCreatedUserId($userId);
             $history->setCreatedAt($this->getUpdatedAt());
             if (!empty($this->importId)) {
                 $history->setImportId($this->importId);
             }
             $history->save($con);
         }
         if (!$this->doReciprocal) {
             $this->updateReciprocal($action, $userId, $schemaId, $con);
         }
         return $affectedRows;
     }
     return false;
 }
 /**
  * Method called to associate a SchemaPropertyElementHistory object to this object
  * through the SchemaPropertyElementHistory foreign key attribute
  *
  * @param      SchemaPropertyElementHistory $l SchemaPropertyElementHistory
  * @return     void
  * @throws     PropelException
  */
 public function addSchemaPropertyElementHistory(SchemaPropertyElementHistory $l)
 {
     $this->collSchemaPropertyElementHistorys[] = $l;
     $l->setFileImportHistory($this);
 }