src/CodeGeneration/Generator/RelationsGenerator.php
protected function getInverseHasType(string $hasType): string
    {
        switch ($hasType) {
            case self::HAS_ONE_TO_ONE:
            case self::HAS_REQUIRED_ONE_TO_ONE:
            case self::HAS_MANY_TO_MANY:
            case self::HAS_REQUIRED_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_OWNING,
                    self::PREFIX_INVERSE,
                    $hasType
                );

            case self::HAS_INVERSE_ONE_TO_ONE:
            case self::HAS_REQUIRED_INVERSE_ONE_TO_ONE:
            case self::HAS_INVERSE_MANY_TO_MANY:
            case self::HAS_REQUIRED_INVERSE_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_INVERSE,
                    self::PREFIX_OWNING,
                    $hasType
                );

            case self::HAS_MANY_TO_ONE:
                return self::HAS_ONE_TO_MANY;

            case self::HAS_REQUIRED_MANY_TO_ONE:
                return self::HAS_REQUIRED_ONE_TO_MANY;

            case self::HAS_ONE_TO_MANY:
                return self::HAS_MANY_TO_ONE;

            case self::HAS_REQUIRED_ONE_TO_MANY:
                return self::HAS_REQUIRED_MANY_TO_ONE;

            default:
                throw new DoctrineStaticMetaException(
                    'invalid $hasType ' . $hasType . ' when trying to get the inverted relation'
                );
        }
    }
protected function getInverseHasType(string $hasType): string
    {
        switch ($hasType) {
            case self::HAS_ONE_TO_ONE:
            case self::HAS_REQUIRED_ONE_TO_ONE:
            case self::HAS_MANY_TO_MANY:
            case self::HAS_REQUIRED_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_OWNING,
                    self::PREFIX_INVERSE,
                    $hasType
                );

            case self::HAS_INVERSE_ONE_TO_ONE:
            case self::HAS_REQUIRED_INVERSE_ONE_TO_ONE:
            case self::HAS_INVERSE_MANY_TO_MANY:
            case self::HAS_REQUIRED_INVERSE_MANY_TO_MANY:
                return \str_replace(
                    self::PREFIX_INVERSE,
                    self::PREFIX_OWNING,
                    $hasType
                );

            case self::HAS_MANY_TO_ONE:
                return self::HAS_ONE_TO_MANY;

            case self::HAS_REQUIRED_MANY_TO_ONE:
                return self::HAS_REQUIRED_ONE_TO_MANY;

            case self::HAS_ONE_TO_MANY:
                return self::HAS_MANY_TO_ONE;

            case self::HAS_REQUIRED_ONE_TO_MANY:
                return self::HAS_REQUIRED_MANY_TO_ONE;

            default:
                throw new DoctrineStaticMetaException(
                    'invalid $hasType ' . $hasType . ' when trying to get the inverted relation'
                );
        }
    }
protected function getInverseHasType ( string $ hasType ) : string { switch ( $ hasType ) { case self :: HAS_ONE_TO_ONE : case self :: HAS_REQUIRED_ONE_TO_ONE : case self :: HAS_MANY_TO_MANY : case self :: HAS_REQUIRED_MANY_TO_MANY : return \ str_replace ( self :: PREFIX_OWNING , self :: PREFIX_INVERSE , $ hasType ) ; case self :: HAS_INVERSE_ONE_TO_ONE : case self :: HAS_REQUIRED_INVERSE_ONE_TO_ONE : case self :: HAS_INVERSE_MANY_TO_MANY : case self :: HAS_REQUIRED_INVERSE_MANY_TO_MANY : return \ str_replace ( self :: PREFIX_INVERSE , self :: PREFIX_OWNING , $ hasType ) ; case self :: HAS_MANY_TO_ONE : return self :: HAS_ONE_TO_MANY ; case self :: HAS_REQUIRED_MANY_TO_ONE : return self :: HAS_REQUIRED_ONE_TO_MANY ; case self :: HAS_ONE_TO_MANY : return self :: HAS_MANY_TO_ONE ; case self :: HAS_REQUIRED_ONE_TO_MANY : return self :: HAS_REQUIRED_MANY_TO_ONE ; default : throw new DoctrineStaticMetaException ( 'invalid $hasType ' . $ hasType . ' when trying to get the inverted relation' ) ; } }
Get the inverse of a hasType

@param string $hasType

@return string
@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.CyclomaticComplexity)
Get the inverse of a hasType