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

		if ( $this->has_relation( $attribute ) ) {
			if ( is_object( $value ) ) {
				$this->set_relation_value( $attribute, $value );

				return $this;
			}

			unset( $this->_relations[ $attribute ] );
		} elseif ( ! array_key_exists( $attribute, static::table()->get_columns() ) ) {
			throw new \OutOfBoundsException(
				sprintf( "Requested attribute '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
			);
		} elseif ( method_exists( $this, $this->get_mutator_method_for_attribute( $attribute ) ) ) {
			$value = call_user_func( array( $this, $this->get_mutator_method_for_attribute( $attribute ) ), $value );
		}

		$columns = static::table()->get_columns();
		$this->set_raw_attribute( $attribute, $columns[ $attribute ]->prepare_for_storage( $value ) );

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

		if ( $this->has_relation( $attribute ) ) {
			if ( is_object( $value ) ) {
				$this->set_relation_value( $attribute, $value );

				return $this;
			}

			unset( $this->_relations[ $attribute ] );
		} elseif ( ! array_key_exists( $attribute, static::table()->get_columns() ) ) {
			throw new \OutOfBoundsException(
				sprintf( "Requested attribute '%s' does not exist for '%s'.", $attribute, get_class( $this ) )
			);
		} elseif ( method_exists( $this, $this->get_mutator_method_for_attribute( $attribute ) ) ) {
			$value = call_user_func( array( $this, $this->get_mutator_method_for_attribute( $attribute ) ), $value );
		}

		$columns = static::table()->get_columns();
		$this->set_raw_attribute( $attribute, $columns[ $attribute ]->prepare_for_storage( $value ) );

		return $this;
	}
Set an attribute's value.

This will call any defined mutators.

@since 2.0

@param string $attribute Attribute name to update.
@param mixed  $value     New value. In most cases this should be working form of the data.
Not the storage version. For example a `WP_Post` object instead of post ID or a
`DateTime` object instead of a 'Y-m-d H:i:s' string.

@return $this

@throws \OutOfBoundsException If the requested attribute does not exist.