src/CodeGeneration/NamespaceHelper.php
public function getBaseHasTypeTraitFqn(
        string $ownedHasName,
        string $hasType
    ): string {
        $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED)
            ? RelationsGenerator::PREFIX_REQUIRED
            : '';

        $hasType = \str_replace(RelationsGenerator::PREFIX_REQUIRED, '', $hasType);
        foreach ([
                     RelationsGenerator::INTERNAL_TYPE_MANY_TO_MANY,
                     RelationsGenerator::INTERNAL_TYPE_ONE_TO_ONE,
                 ] as $noStrip) {
            if (\ts\stringContains($hasType, $noStrip)) {
                return 'Has' . $required . $ownedHasName . $hasType;
            }
        }

        foreach ([
                     RelationsGenerator::INTERNAL_TYPE_ONE_TO_MANY,
                     RelationsGenerator::INTERNAL_TYPE_MANY_TO_ONE,
                 ] as $stripAll) {
            if (\ts\stringContains($hasType, $stripAll)) {
                return str_replace(
                    [
                        RelationsGenerator::PREFIX_OWNING,
                        RelationsGenerator::PREFIX_INVERSE,
                    ],
                    '',
                    'Has' . $required . $ownedHasName . $hasType
                );
            }
        }

        return str_replace(
            [
                RelationsGenerator::PREFIX_INVERSE,
            ],
            '',
            'Has' . $required . $ownedHasName . $hasType
        );
    }
public function getBaseHasTypeTraitFqn(
        string $ownedHasName,
        string $hasType
    ): string {
        $required = \ts\stringContains($hasType, RelationsGenerator::PREFIX_REQUIRED)
            ? RelationsGenerator::PREFIX_REQUIRED
            : '';

        $hasType = \str_replace(RelationsGenerator::PREFIX_REQUIRED, '', $hasType);
        foreach ([
                     RelationsGenerator::INTERNAL_TYPE_MANY_TO_MANY,
                     RelationsGenerator::INTERNAL_TYPE_ONE_TO_ONE,
                 ] as $noStrip) {
            if (\ts\stringContains($hasType, $noStrip)) {
                return 'Has' . $required . $ownedHasName . $hasType;
            }
        }

        foreach ([
                     RelationsGenerator::INTERNAL_TYPE_ONE_TO_MANY,
                     RelationsGenerator::INTERNAL_TYPE_MANY_TO_ONE,
                 ] as $stripAll) {
            if (\ts\stringContains($hasType, $stripAll)) {
                return str_replace(
                    [
                        RelationsGenerator::PREFIX_OWNING,
                        RelationsGenerator::PREFIX_INVERSE,
                    ],
                    '',
                    'Has' . $required . $ownedHasName . $hasType
                );
            }
        }

        return str_replace(
            [
                RelationsGenerator::PREFIX_INVERSE,
            ],
            '',
            'Has' . $required . $ownedHasName . $hasType
        );
    }
public function getBaseHasTypeTraitFqn ( string $ ownedHasName , string $ hasType ) : string { $ required = \ ts \ stringContains ( $ hasType , RelationsGenerator :: PREFIX_REQUIRED ) ? RelationsGenerator :: PREFIX_REQUIRED : '' ; $ hasType = \ str_replace ( RelationsGenerator :: PREFIX_REQUIRED , '' , $ hasType ) ; foreach ( [ RelationsGenerator :: INTERNAL_TYPE_MANY_TO_MANY , RelationsGenerator :: INTERNAL_TYPE_ONE_TO_ONE , ] as $ noStrip ) { if ( \ ts \ stringContains ( $ hasType , $ noStrip ) ) { return 'Has' . $ required . $ ownedHasName . $ hasType ; } } foreach ( [ RelationsGenerator :: INTERNAL_TYPE_ONE_TO_MANY , RelationsGenerator :: INTERNAL_TYPE_MANY_TO_ONE , ] as $ stripAll ) { if ( \ ts \ stringContains ( $ hasType , $ stripAll ) ) { return str_replace ( [ RelationsGenerator :: PREFIX_OWNING , RelationsGenerator :: PREFIX_INVERSE , ] , '' , 'Has' . $ required . $ ownedHasName . $ hasType ) ; } } return str_replace ( [ RelationsGenerator :: PREFIX_INVERSE , ] , '' , 'Has' . $ required . $ ownedHasName . $ hasType ) ; }
Normalise a has type, removing prefixes that are not required

Inverse hasTypes use the standard template without the prefix
The exclusion ot this are the ManyToMany and OneToOne relations

@param string $ownedHasName
@param string $hasType

@return string
Normalise a has type removing prefixes that are not required