If the key is changed, notify old & new reverse relations and initialize the new relation
497319
function( model, attr, options ) {
			// Don't accept recursive calls to onChange (like onChange->findRelated->findOrCreate->initializeRelations->addRelated->onChange)
			if ( this.isLocked() ) {
				return;
			}
			this.acquire();
			options = this.sanitizeOptions( options );
			
			// 'options._related' is set by 'addRelated'/'removeRelated'. If it is set, the change
			// is the result of a call from a relation. If it's not, the change is the result of 
			// a 'set' call on this.instance.
			var changed = _.isUndefined( options._related );
			var oldRelated = changed ? this.related : options._related;
			
			if ( changed ) {	
				this.keyContents = attr;
				
				// Set new 'related'
				if ( attr instanceof this.relatedModel ) {
					this.related = attr;
				}
				else if ( attr ) {
					var related = this.findRelated( options );
					this.setRelated( related );
				}
				else {
					this.setRelated( null );
				}
			}
			
			// Notify old 'related' object of the terminated relation
			if ( oldRelated && this.related !== oldRelated ) {
				_.each( this.getReverseRelations( oldRelated ), function( relation ) {
						relation.removeRelated( this.instance, options );
					}, this );
			}
			
			// Notify new 'related' object of the new relation. Note we do re-apply even if this.related is oldRelated;
			// that can be necessary for bi-directional relations if 'this.instance' was created after 'this.related'.
			// In that case, 'this.instance' will already know 'this.related', but the reverse might not exist yet.
			_.each( this.getReverseRelations(), function( relation ) {
					relation.addRelated( this.instance, options );
				}, this);
			
			// Fire the 'update:<key>' event if 'related' was updated
			if ( !options.silentChange && this.related !== oldRelated ) {
				var dit = this;
				Backbone.Relational.eventQueue.add( function() {
					dit.instance.trigger( 'update:' + dit.key, dit.instance, dit.related, options );
				});
			}
			this.release();
		}
280710
def rename(self, new_relation):
        
        # Relations store this stuff inside their `path` dict. But they
        # also store a table_name, and usually use it in their  .render(),
        # so we need to update that as well. It doesn't appear that
        # table_name is ever anything but the identifier (via .create())
        self.inner = self.inner.incorporate(
            path={
                'database': new_relation.inner.database,
                'schema': new_relation.inner.schema,
                'identifier': new_relation.inner.identifier
            },
            table_name=new_relation.inner.identifier
        )
1113863
def copy_with_new_relations(self, new_relations):
        """"""
        result = self.__class__(self.forward.items())
        result.add_relations(new_relations.items())
        result.previous_ends1 = set(new_relations.values())
        return result
20020
function( relation ) {
			if ( relation.instance instanceof this.relatedModel && this.reverseRelation.key === relation.key
					&&	this.key === relation.reverseRelation.key ) {
				return true;
			}
			return false;
		}
1367110
public void handleInitialKey()                  // init this field override for other value
    {
        KeyArea keyArea = this.getKeyArea(-1);
        if (keyArea == null)
            return;
        BaseBuffer buffer = new VectorBuffer(null);
        boolean[] rgbModified = keyArea.getModified();
        boolean[] rgbNullable = keyArea.setNullable(true);
        keyArea.setupKeyBuffer(buffer, DBConstants.FILE_KEY_AREA);
        keyArea.zeroKeyFields(DBConstants.START_SELECT_KEY);        // Zero out the key fields
        BaseListener  nextListener = this.getNextEnabledListener();
        if (nextListener != null)
            ((FileListener)nextListener).doInitialKey();
        else
            this.doInitialKey();
        keyArea.setNullable(rgbNullable);
        keyArea.setModified(rgbModified);
        keyArea.reverseKeyBuffer(buffer, DBConstants.FILE_KEY_AREA);
    }
1369837
def refresh(self, key):
        """"""
        s0 = self[key]
        s = self.backtrack(key)
        s.persist(**s0.metadata['persist_kwargs'])
1132212
def after_model_change(self, form, User, is_created):
        """"""
        if is_created and form.notification.data is True:
            send_reset_password_instructions(User)
1165860
def _trigger_refresh(self, key):
        ""
        if self.top_level:
            self.update(key)
        else:
            self.current_key = None
            self.current_frame = None
439126
def _has_changed_related(instance):
    
    tracked_related_fields = getattr(
        instance,
        '_tracked_related_fields',
        {}
    ).keys()
    for field, value in instance._original_fields.items():
        if field != 'pk' and \
           not isinstance(instance._meta.get_field(field), ManyToManyField):
            if field in tracked_related_fields:
                if isinstance(instance._meta.get_field(field), ForeignKey):
                    if getattr(instance, '{0}_id'.format(field)) != value:
                        return True
                else:
                    if getattr(instance, field) != value:
                        return True
    return False
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
268767
function(_key,_event){
            if (_event.state==0){
                _doClearAction(_key);
            }
            _doStateChangeCallback(_key,_event.state);
        }
658036
void update()
    {
        mx = x - oldX;
        my = y - oldY;
        oldX = x;
        oldY = y;
    }
505149
def meta_changed(self, model, prop_name, info):
        
        if self.parent is not None:
            msg = info.arg
            # Add information about notification to the signal message
            notification = Notification(model, prop_name, info)
            msg = msg._replace(notification=notification)
            info.arg = msg
            self.parent.meta_changed(model, prop_name, info)
1355069
def record_changed?(reflection, record, key)
        record.new_record? ||
          association_foreign_key_changed?(reflection, record, key) ||
          record.will_save_change_to_attribute?(reflection.foreign_key)
      end
1020293
private function changed()
    {
        if ($this->isDirty) {
            return;
        }

        $this->isDirty = true;

        if ($this->association instanceof ManyToManyAssociationMetadata &&
            $this->owner &&
            $this->association->isOwningSide() &&
            $this->em->getClassMetadata(get_class($this->owner))->changeTrackingPolicy === ChangeTrackingPolicy::NOTIFY) {
            $this->em->getUnitOfWork()->scheduleForSynchronization($this->owner);
        }
    }
836415
def updateitem(self, key, new_val):
        
        if key not in self._position:
            raise KeyError(key)
        self[key] = new_val
454470
protected void notifyUpdate(String key, Map<String, Object> value) {
        if (value.size() == 1) {
            Map.Entry<String, Object> entry = value.entrySet().iterator().next();
            notifyUpdate(entry.getKey(), entry.getValue());
            return;
        }
        for (ISharedObjectListener listener : listeners) {
            listener.onSharedObjectUpdate(this, key, value);
        }
    }