public function getDiscriminatedClass(PropertyMetadata $mapping, $discriminator = null)
    {
        if ($discriminator === null) {
            $discriminator = $mapping->discriminatorDefaultValue;
        }

        if ($discriminator !== null) {
            if (isset($mapping->discriminatorMap[$discriminator])) {
                $discriminator = $mapping->discriminatorMap[$discriminator];
            }

            return $this->dm->getClassMetadata($discriminator);
        }

        if ($mapping->targetDocument === null) {
            throw ODMException::mixedAssociationRequiresDiscriminator();
        }

        //get the class
        $class = $this->dm->getClassMetadata($mapping->targetDocument);

        //check for single-table inheritance discriminator
        if ($class->discriminatorDefaultValue !== null) {
            $discriminator = $class->discriminatorDefaultValue;
        }

        if ($discriminator !== null) {
            if (isset($class->discriminatorMap[$discriminator])) {
                $discriminator = $class->discriminatorMap[$discriminator];
            }

            $class = $this->dm->getClassMetadata($discriminator);
        }

        return $class;
    }
public function getDiscriminatedClass(PropertyMetadata $mapping, $discriminator = null)
    {
        if ($discriminator === null) {
            $discriminator = $mapping->discriminatorDefaultValue;
        }

        if ($discriminator !== null) {
            if (isset($mapping->discriminatorMap[$discriminator])) {
                $discriminator = $mapping->discriminatorMap[$discriminator];
            }

            return $this->dm->getClassMetadata($discriminator);
        }

        if ($mapping->targetDocument === null) {
            throw ODMException::mixedAssociationRequiresDiscriminator();
        }

        //get the class
        $class = $this->dm->getClassMetadata($mapping->targetDocument);

        //check for single-table inheritance discriminator
        if ($class->discriminatorDefaultValue !== null) {
            $discriminator = $class->discriminatorDefaultValue;
        }

        if ($discriminator !== null) {
            if (isset($class->discriminatorMap[$discriminator])) {
                $discriminator = $class->discriminatorMap[$discriminator];
            }

            $class = $this->dm->getClassMetadata($discriminator);
        }

        return $class;
    }
public function getDiscriminatedClass ( PropertyMetadata $ mapping , $ discriminator = null ) { if ( $ discriminator === null ) { $ discriminator = $ mapping -> discriminatorDefaultValue ; } if ( $ discriminator !== null ) { if ( isset ( $ mapping -> discriminatorMap [ $ discriminator ] ) ) { $ discriminator = $ mapping -> discriminatorMap [ $ discriminator ] ; } return $ this -> dm -> getClassMetadata ( $ discriminator ) ; } if ( $ mapping -> targetDocument === null ) { throw ODMException :: mixedAssociationRequiresDiscriminator ( ) ; } //get the class $ class = $ this -> dm -> getClassMetadata ( $ mapping -> targetDocument ) ; //check for single-table inheritance discriminator if ( $ class -> discriminatorDefaultValue !== null ) { $ discriminator = $ class -> discriminatorDefaultValue ; } if ( $ discriminator !== null ) { if ( isset ( $ class -> discriminatorMap [ $ discriminator ] ) ) { $ discriminator = $ class -> discriminatorMap [ $ discriminator ] ; } $ class = $ this -> dm -> getClassMetadata ( $ discriminator ) ; } return $ class ; }
Get the class metadata for an association's target, with respect to any
discriminator value.

@param PropertyMetadata $mapping
@param mixed|null       $discriminator

@return ClassMetadata

@throws ODMException
Get the class metadata for an association s target with respect to any discriminator value .