src/Form/Annotation/ElementResolverListener.php
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']);
        }
    }
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']);
        }
    }
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' ] ) ; } }
ObjectSelect target class resolver

Resolves the interface (specification) into entity object class

@param \Zend\EventManager\EventInterface $e
ObjectSelect target class resolver