/**
* Tries to identify the class of an rid by matching it against
* the clusters in the database
*
* @param Rid $rid
*
* @throws MappingException
* @return string
*/
public function identifyClass(Rid $rid)
{
$map = $this->getMap();
$splitRid = explode(':', ltrim($rid->getValue(), '#'));
$clusterId = $splitRid[0];
foreach ($map as $class => $clusters) {
if (in_array($clusterId, $clusters)) {
return $class;
}
}
throw MappingException::noClusterForRid($rid);
}