public function resolveObjectSelectTargetClass($e)
    {
        $elementSpec = $e->getParam('elementSpec');
        if (!isset($elementSpec['spec']['type'])) {
            return;
        }

        $type = $elementSpec['spec']['type'];
        if (strtolower($type) !== 'objectselect' && !$type instanceof ObjectSelect) {
            return;
        }

        if (isset($elementSpec['spec']['options']['target_class']) &&
            class_exists($elementSpec['spec']['options']['target_class']) ||
            empty($formSpec['object'])
        ) {
            return;
        }

        $formSpec = $e->getParam('formSpec');
        $metadata = $this->objectManager->getClassMetadata($formSpec['object']);

        if ($metadata->hasAssociation($elementSpec['spec']['name'])) {
            $elementSpec['spec']['options']['target_class'] =
                $metadata->getAssociationTargetClass($elementSpec['spec']['name']);
        }
    }