lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
/**
     * Validate runtime metadata is correctly defined.
     *
     * @throws MappingException
     */
Validate runtime metadata is correctly defined.
Validate runtime metadata is correctly defined .
protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void
    {
        if (! $class->getReflectionClass()) {
            return;
        }
        $class->validateIdentifier();
        $class->validateAssociations();
        $class->validateLifecycleCallbacks($this->getReflectionService());
        if (! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) {
            if (! $parent) {
                if (! $class->discriminatorMap) {
                    throw MappingException::missingDiscriminatorMap($class->getClassName());
                }
                if (! $class->discriminatorColumn) {
                    throw MappingException::missingDiscriminatorColumn($class->getClassName());
                }
            }
        } elseif (($class->discriminatorMap || $class->discriminatorColumn) && $class->isMappedSuperclass && $class->isRootEntity()) {
            throw MappingException::noInheritanceOnMappedSuperClass($class->getClassName());
        }
    }
protected function validateRuntimeMetadata ( ClassMetadata $ class , ? ClassMetadata $ parent = null ) : void { if ( ! $ class -> getReflectionClass ( ) ) { return ; } $ class -> validateIdentifier ( ) ; $ class -> validateAssociations ( ) ; $ class -> validateLifecycleCallbacks ( $ this -> getReflectionService ( ) ) ; if ( ! $ class -> isMappedSuperclass && $ class -> inheritanceType !== InheritanceType :: NONE ) { if ( ! $ parent ) { if ( ! $ class -> discriminatorMap ) { throw MappingException :: missingDiscriminatorMap ( $ class -> getClassName ( ) ) ; } if ( ! $ class -> discriminatorColumn ) { throw MappingException :: missingDiscriminatorColumn ( $ class -> getClassName ( ) ) ; } } } elseif ( ( $ class -> discriminatorMap || $ class -> discriminatorColumn ) && $ class -> isMappedSuperclass && $ class -> isRootEntity ( ) ) { throw MappingException :: noInheritanceOnMappedSuperClass ( $ class -> getClassName ( ) ) ; } }
Validate runtime metadata is correctly defined.
Validate runtime metadata is correctly defined .
// only validate if there is a reflection class instance // verify inheritance // second condition is necessary for mapped superclasses in the middle of an inheritance hierarchy