private function getDiscriminatorData(array $referenceMapping, ClassMetadata $class) : array
    {
        $discriminatorField = null;
        $discriminatorValue = null;
        $discriminatorMap   = null;

        if (isset($referenceMapping['discriminatorField'])) {
            $discriminatorField = $referenceMapping['discriminatorField'];

            if (isset($referenceMapping['discriminatorMap'])) {
                $discriminatorMap = $referenceMapping['discriminatorMap'];
            }
        } else {
            $discriminatorField = $class->discriminatorField;
            $discriminatorValue = $class->discriminatorValue;
            $discriminatorMap   = $class->discriminatorMap;
        }

        if ($discriminatorField === null) {
            return [];
        }

        if ($discriminatorValue === null) {
            if (! empty($discriminatorMap)) {
                $pos = array_search($class->name, $discriminatorMap);

                if ($pos !== false) {
                    $discriminatorValue = $pos;
                }
            } else {
                $discriminatorValue = $class->name;
            }
        }

        if ($discriminatorValue === null) {
            throw MappingException::unlistedClassInDiscriminatorMap($class->name);
        }

        return [$discriminatorField => $discriminatorValue];
    }
private function getDiscriminatorData(array $referenceMapping, ClassMetadata $class) : array
    {
        $discriminatorField = null;
        $discriminatorValue = null;
        $discriminatorMap   = null;

        if (isset($referenceMapping['discriminatorField'])) {
            $discriminatorField = $referenceMapping['discriminatorField'];

            if (isset($referenceMapping['discriminatorMap'])) {
                $discriminatorMap = $referenceMapping['discriminatorMap'];
            }
        } else {
            $discriminatorField = $class->discriminatorField;
            $discriminatorValue = $class->discriminatorValue;
            $discriminatorMap   = $class->discriminatorMap;
        }

        if ($discriminatorField === null) {
            return [];
        }

        if ($discriminatorValue === null) {
            if (! empty($discriminatorMap)) {
                $pos = array_search($class->name, $discriminatorMap);

                if ($pos !== false) {
                    $discriminatorValue = $pos;
                }
            } else {
                $discriminatorValue = $class->name;
            }
        }

        if ($discriminatorValue === null) {
            throw MappingException::unlistedClassInDiscriminatorMap($class->name);
        }

        return [$discriminatorField => $discriminatorValue];
    }
private function getDiscriminatorData ( array $ referenceMapping , ClassMetadata $ class ) : array { $ discriminatorField = null ; $ discriminatorValue = null ; $ discriminatorMap = null ; if ( isset ( $ referenceMapping [ 'discriminatorField' ] ) ) { $ discriminatorField = $ referenceMapping [ 'discriminatorField' ] ; if ( isset ( $ referenceMapping [ 'discriminatorMap' ] ) ) { $ discriminatorMap = $ referenceMapping [ 'discriminatorMap' ] ; } } else { $ discriminatorField = $ class -> discriminatorField ; $ discriminatorValue = $ class -> discriminatorValue ; $ discriminatorMap = $ class -> discriminatorMap ; } if ( $ discriminatorField === null ) { return [ ] ; } if ( $ discriminatorValue === null ) { if ( ! empty ( $ discriminatorMap ) ) { $ pos = array_search ( $ class -> name , $ discriminatorMap ) ; if ( $ pos !== false ) { $ discriminatorValue = $ pos ; } } else { $ discriminatorValue = $ class -> name ; } } if ( $ discriminatorValue === null ) { throw MappingException :: unlistedClassInDiscriminatorMap ( $ class -> name ) ; } return [ $ discriminatorField => $ discriminatorValue ] ; }
Build discriminator portion of reference for specified reference mapping and class metadata.

@param array         $referenceMapping Mappings of reference for which discriminator data is created.
@param ClassMetadata $class            Metadata of reference document class.

@return array with next structure [{discriminator field} => {discriminator value}]

@throws MappingException When discriminator map is present and reference class in not registered in it.
Build discriminator portion of reference for specified reference mapping and class metadata .