src/Model.php
public function get_relation( $attribute ) {

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

		$method   = "_{$attribute}_relation";
		$relation = $this->{$method}();

		if ( ! $relation instanceof Relation ) {
			throw new \UnexpectedValueException( 'Relation methods must return an IronBound\DB\Relations\Relation object.' );
		}

		return $relation;
	}
public function get_relation( $attribute ) {

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

		$method   = "_{$attribute}_relation";
		$relation = $this->{$method}();

		if ( ! $relation instanceof Relation ) {
			throw new \UnexpectedValueException( 'Relation methods must return an IronBound\DB\Relations\Relation object.' );
		}

		return $relation;
	}
Get a relation's controller object.

@since 2.0

@param string $attribute Relation name.

@return Relation

@throws \OutOfBoundsException If no relation exists by the given name.
@throws \UnexpectedValueException If relation method returns an invalid value.