protected static function _relations($type = null, $name = null) {
		$self = static::_object();

		if ($name) {
			if (isset($self->_relationsToLoad[$name])) {
				$t = $self->_relationsToLoad[$name];
				unset($self->_relationsToLoad[$name]);
				return static::bind($t, $name, (array) $self->{$t}[$name]);
			}
			return isset($self->_relations[$name]) ? $self->_relations[$name] : null;
		}
		if (!$type) {
			foreach ($self->_relationsToLoad as $name => $t) {
				static::bind($t, $name, (array) $self->{$t}[$name]);
			}
			$self->_relationsToLoad = [];
			return $self->_relations;
		}
		foreach ($self->_relationsToLoad as $name => $t) {
			if ($type === $t) {
				static::bind($t, $name, (array) $self->{$t}[$name]);
				unset($self->_relationsToLoad[$name]);
			}
		}
		return array_filter($self->_relations, function($i) use ($type) {
			return $i->data('type') === $type;
		});
	}
protected static function _relations($type = null, $name = null) {
		$self = static::_object();

		if ($name) {
			if (isset($self->_relationsToLoad[$name])) {
				$t = $self->_relationsToLoad[$name];
				unset($self->_relationsToLoad[$name]);
				return static::bind($t, $name, (array) $self->{$t}[$name]);
			}
			return isset($self->_relations[$name]) ? $self->_relations[$name] : null;
		}
		if (!$type) {
			foreach ($self->_relationsToLoad as $name => $t) {
				static::bind($t, $name, (array) $self->{$t}[$name]);
			}
			$self->_relationsToLoad = [];
			return $self->_relations;
		}
		foreach ($self->_relationsToLoad as $name => $t) {
			if ($type === $t) {
				static::bind($t, $name, (array) $self->{$t}[$name]);
				unset($self->_relationsToLoad[$name]);
			}
		}
		return array_filter($self->_relations, function($i) use ($type) {
			return $i->data('type') === $type;
		});
	}
protected static function _relations ( $ type = null , $ name = null ) { $ self = static :: _object ( ) ; if ( $ name ) { if ( isset ( $ self -> _relationsToLoad [ $ name ] ) ) { $ t = $ self -> _relationsToLoad [ $ name ] ; unset ( $ self -> _relationsToLoad [ $ name ] ) ; return static :: bind ( $ t , $ name , ( array ) $ self -> { $ t } [ $ name ] ) ; } return isset ( $ self -> _relations [ $ name ] ) ? $ self -> _relations [ $ name ] : null ; } if ( ! $ type ) { foreach ( $ self -> _relationsToLoad as $ name => $ t ) { static :: bind ( $ t , $ name , ( array ) $ self -> { $ t } [ $ name ] ) ; } $ self -> _relationsToLoad = [ ] ; return $ self -> _relations ; } foreach ( $ self -> _relationsToLoad as $ name => $ t ) { if ( $ type === $ t ) { static :: bind ( $ t , $ name , ( array ) $ self -> { $ t } [ $ name ] ) ; unset ( $ self -> _relationsToLoad [ $ name ] ) ; } } return array_filter ( $ self -> _relations , function ( $ i ) use ( $ type ) { return $ i -> data ( 'type' ) === $ type ; } ) ; }
This method automagically bind in the fly unloaded relations.

@see lithium\data\Model::relations()
@param $type A type of model relation.
@param $name A relation name.
@return An array of relation instances or an instance of relation.
This method automagically bind in the fly unloaded relations .