/** * Executes a query against OrientDB, via the protocolAdapter, specifying * a $fetchPlan (which is optional) and a $rid to look for. * Then, it finalizes the hydration result. * * @param type $rid * @param mixed $fetchPlan * @return object|null */ protected function doFind($rid, $fetchPlan = null) { $query = new Query(array($rid)); $adapter = $this->getProtocolAdapter(); $execution = $adapter->execute($query->getRaw(), true, $fetchPlan); if ($execution && $result = $adapter->getResult()) { $record = is_array($result) ? array_shift($result) : $result; $result = $this->getMapper()->hydrate($record); return $this->finalize($result); } return null; }