private function getVersionedClassMetadata()
    {
        if (isset($this->class->fieldMappings[$this->class->versionField]['inherited'])) {
            $definingClassName = $this->class->fieldMappings[$this->class->versionField]['inherited'];

            return $this->em->getClassMetadata($definingClassName);
        }

        return $this->class;
    }