public function getRelation($sourceId, $targetId) { try { $relation = new Relation(); $relation->setSourceId($sourceId); $relation->setTargetId($targetId); $newRelation = $this->provider->searchRelation($relation); if ($newRelation == null) { $relation->setSourceId($targetId); $relation->setTargetId($sourceId); $newRelation = $this->provider->searchRelation($relation); } return $newRelation; } catch (EyePeopleException $e) { throw new EyePeopleException('Unable to find the relation between the user ' . $relation->getSourceId() . ' and the user ' . $relation->getTargetId(), 0, $e); } }