public function relation($relationName) {
		if(!$this->dataMapper->hasRelation($this->definition, $relationName))
			throw new \Exception('Relation '.$relationName.' does not exist.');
		$relation = $this->dataMapper->relation($this->definition, $relationName);
		$reverseRelation = $relation->reverse();
		$reverseRelationName = $reverseRelation->get('name');
		$relation_entity = $relation->get('entity');

		$table = $this->getTable();
		$alias = $reverseRelationName;

		$c = clone $this;
		$c->applyScopes();

		$where = $this->processConditions($c->getWhere());
		$where = $this->updateConditions($where, $table, $alias);

		return $this->dataMapper->orm($relation_entity)
			->where($where)
			->join('innerjoin '.$reverseRelationName, $this->join);
	}
public function relation($relationName) {
		if(!$this->dataMapper->hasRelation($this->definition, $relationName))
			throw new \Exception('Relation '.$relationName.' does not exist.');
		$relation = $this->dataMapper->relation($this->definition, $relationName);
		$reverseRelation = $relation->reverse();
		$reverseRelationName = $reverseRelation->get('name');
		$relation_entity = $relation->get('entity');

		$table = $this->getTable();
		$alias = $reverseRelationName;

		$c = clone $this;
		$c->applyScopes();

		$where = $this->processConditions($c->getWhere());
		$where = $this->updateConditions($where, $table, $alias);

		return $this->dataMapper->orm($relation_entity)
			->where($where)
			->join('innerjoin '.$reverseRelationName, $this->join);
	}
public function relation ( $ relationName ) { if ( ! $ this -> dataMapper -> hasRelation ( $ this -> definition , $ relationName ) ) throw new \ Exception ( 'Relation ' . $ relationName . ' does not exist.' ) ; $ relation = $ this -> dataMapper -> relation ( $ this -> definition , $ relationName ) ; $ reverseRelation = $ relation -> reverse ( ) ; $ reverseRelationName = $ reverseRelation -> get ( 'name' ) ; $ relation_entity = $ relation -> get ( 'entity' ) ; $ table = $ this -> getTable ( ) ; $ alias = $ reverseRelationName ; $ c = clone $ this ; $ c -> applyScopes ( ) ; $ where = $ this -> processConditions ( $ c -> getWhere ( ) ) ; $ where = $ this -> updateConditions ( $ where , $ table , $ alias ) ; return $ this -> dataMapper -> orm ( $ relation_entity ) -> where ( $ where ) -> join ( 'innerjoin ' . $ reverseRelationName , $ this -> join ) ; }
Return a new ORM for the given relation.
@param  string $relationName
@return ORMInterface
Return a new ORM for the given relation .