src/Model.php
public function set_relation_value( $attribute, $value ) {

		if ( ! $this->has_relation( $attribute ) ) {
			throw new \OutOfBoundsException(
				sprintf( "Requested relation '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
			);
		}

		$this->_relations[ $attribute ] = $value;

		return $this;
	}
public function set_relation_value( $attribute, $value ) {

		if ( ! $this->has_relation( $attribute ) ) {
			throw new \OutOfBoundsException(
				sprintf( "Requested relation '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
			);
		}

		$this->_relations[ $attribute ] = $value;

		return $this;
	}
Set the value for a relation.

@since 2.0

@param string $attribute Relation name.
@param mixed  $value     Relation value.

@return $this

@throws \OutOfBoundsException If no relation exists by the given name.