Overwrites {Relatable#set_relationship} to set the dirty state of the
 relationship. See {Dirty#set_dirty!} as well.
350063
def set_relationship(key, value)
      existing = relationship_data[key]
      new_value = super
      set_dirty!(key, existing, new_value)
    end
1087105
function addRelationshipsToJDL() {
  for (let i = 0, entityNames = Object.keys(configuration.entities); i < entityNames.length; i++) {
    dealWithRelationships(configuration.entities[entityNames[i]].relationships, entityNames[i]);
  }
}
787255
function(relationshipModelName, kind) {
    var key = decamelize(relationshipModelName);
    if (kind === "belongsTo") {
      return key + "_id";
    } else if (kind === "hasMany") {
      return singularize(key) + "_ids";
    } else {
      return key;
    }
  }
936648
private void applyProperties(AssociationKey associationKey, Tuple associationRow, Relationship relationship) {
		String[] indexColumns = associationKey.getMetadata().getRowKeyIndexColumnNames();
		for ( int i = 0; i < indexColumns.length; i++ ) {
			String propertyName = indexColumns[i];
			Object propertyValue = associationRow.get( propertyName );
			relationship.setProperty( propertyName, propertyValue );
		}
	}
1191502
function defineRelationshipResolution(
  schema: GraphQLSchema,
  relationships: Relationship[],
  database: DatabaseInterface,
): void {
  relationships.forEach(relationship => {
    defineFieldResolve(
      schema,
      relationship.path[0].fromType,
      relationship.fieldName,
      database.generateRelationshipResolver(relationship),
    );
  });
}
1160427
def apply_relationships(self, data, obj):
        
        relationships_to_apply = []
        relationship_fields = get_relationships(self.resource.schema, model_field=True)
        for key, value in data.items():
            if key in relationship_fields:
                related_model = getattr(obj.__class__, key).property.mapper.class_
                schema_field = get_schema_field(self.resource.schema, key)
                related_id_field = self.resource.schema._declared_fields[schema_field].id_field

                if isinstance(value, list):
                    related_objects = []

                    for identifier in value:
                        related_object = self.get_related_object(related_model, related_id_field, {'id': identifier})
                        related_objects.append(related_object)

                    relationships_to_apply.append({'field': key, 'value': related_objects})
                else:
                    related_object = None

                    if value is not None:
                        related_object = self.get_related_object(related_model, related_id_field, {'id': value})

                    relationships_to_apply.append({'field': key, 'value': related_object})

        for relationship in relationships_to_apply:
            setattr(obj, relationship['field'], relationship['value'])
768631
def added_to_relationship(proxy)
      was_clean = parent.nil? && !changed?

      write_attribute(:parent, proxy.parent)
      write_attribute(:parent_collection, proxy)

      # This keeps existing records not dirty when added to collection
      clear_dirty! if !new_record? && was_clean
    end
722731
function() {
    var self = this

    Object.keys(this.definition.relations).forEach(function(key) {
      delete self.relations[key]
    })

    return this
  }
1066453
def dirty_attributes
      dirty_attributes = {}

      original_attributes.each_key do |property|
        next unless property.respond_to?(:dump)
        dirty_attributes[property] = property.dump(property.get!(self))
      end

      dirty_attributes
    end
1372166
def initialize_attributes(caller, raw)
      # Save the interface and parent
      write_attribute(:parent, caller)
      write_attribute(:interface, raw)

      # Load the attributes from the interface
      load_interface_attributes(interface)

      # Get the relationships setup
      populate_relationship(:network_interfaces, interface)

      # Clear dirty and mark as existing
      clear_dirty!
      existing_record!
    end
1012370
public static void preUpdateCheck(AtlasRelationshipDef newRelationshipDef, AtlasRelationshipDef existingRelationshipDef) throws AtlasBaseException {
        // do not allow renames of the Def.
        String existingName = existingRelationshipDef.getName();
        String newName      = newRelationshipDef.getName();

        if (!existingName.equals(newName)) {
            throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_NAME_UPDATE,
                    newRelationshipDef.getGuid(),existingName, newName);
        }

        RelationshipCategory existingRelationshipCategory = existingRelationshipDef.getRelationshipCategory();
        RelationshipCategory newRelationshipCategory      = newRelationshipDef.getRelationshipCategory();

        if ( !existingRelationshipCategory.equals(newRelationshipCategory)){
            throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_CATEGORY_UPDATE,
                    newRelationshipDef.getName(),newRelationshipCategory.name(),
                    existingRelationshipCategory.name() );
        }

        AtlasRelationshipEndDef existingEnd1 = existingRelationshipDef.getEndDef1();
        AtlasRelationshipEndDef newEnd1      = newRelationshipDef.getEndDef1();

        if ( !newEnd1.equals(existingEnd1) ) {
            throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END1_UPDATE,
                                         newRelationshipDef.getName(), newEnd1.toString(), existingEnd1.toString());
        }

        AtlasRelationshipEndDef existingEnd2 = existingRelationshipDef.getEndDef2();
        AtlasRelationshipEndDef newEnd2      = newRelationshipDef.getEndDef2();

        if ( !newEnd2.equals(existingEnd2) ) {
                throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_INVALID_END2_UPDATE,
                                         newRelationshipDef.getName(), newEnd2.toString(), existingEnd2.toString());
        }
    }
469036
function setAttribute(element, name, value) {
  assertType(element, Node, false, 'Invalid element specified');
  if (value === undefined || value === null || value === false)
    element.removeAttribute(name);
  else if (value === true)
    element.setAttribute(name, '');
  else
    element.setAttribute(name, value);
  if (name === 'disabled' && element.setDirty)
    element.setDirty(DirtyType.STATE);
}
789197
def update(self, **kwargs):
        
        data = self._generate_input_dict(**kwargs)
        url = self.parent.url + '/relationship'
        self.load(self.client.put(url, data=data))
        return self
767843
protected void updateDirtyState() {
		boolean dirty = isDirty();
		if (oldDirty != dirty) {
			oldDirty = dirty;
			firePropertyChange(DIRTY_PROPERTY, !dirty, dirty);
		}
	}
939604
def initialize_attributes(parent, inat)
      write_attribute(:parent, parent)
      write_attribute(:interface, inat)

      # Load the interface attributes associated with this model
      load_interface_attributes(inat)
      populate_relationships(inat)

      # Clear dirty and set as existing
      clear_dirty!
      existing_record!
    end
1132123
public function markAsUpdated()
    {
        $this->row->markAsUpdated();
        foreach ($this->getCurrentReflection()->getEntityProperties() as $property) {
            if ($property->hasRelationship() and ($property->getRelationship() instanceof Relationship\HasMany)) {
                $relationship = $property->getRelationship();
                $this->row->cleanReferencingAddedAndRemovedMeta(
                    $relationship->getRelationshipTable(),
                    $relationship->getColumnReferencingSourceTable(),
                    null,
                    $relationship->getStrategy()
                );
            }
        }
    }
1112384
def reload_relations
      relations.each_pair do |name, meta|
        if instance_variable_defined?("@_#{name}")
          if _parent.nil? || instance_variable_get("@_#{name}") != _parent
            remove_instance_variable("@_#{name}")
          end
        end
      end
    end