src/CodeGeneration/Generator/RelationsGenerator.php
public function setEntityHasRelationToEntity(
        string $owningEntityFqn,
        string $hasType,
        string $ownedEntityFqn,
        bool $requiredReciprocation = false,
        bool $internalUseOnly = true
    ): void {
        $reciprocate = $internalUseOnly;
        try {
            $this->validateHasType($hasType);
            list(
                $owningTraitPath,
                $owningInterfacePath,
                $reciprocatingInterfacePath,
                ) = $this->getPathsForOwningTraitsAndInterfaces(
                    $hasType,
                    $ownedEntityFqn
                );
            list($owningClass, , $owningClassSubDirs) = $this->parseFullyQualifiedName($owningEntityFqn);
            $owningClassPath = $this->pathHelper->getPathFromNameAndSubDirs(
                $this->pathToProjectRoot,
                $owningClass,
                $owningClassSubDirs
            );
            $this->useRelationTraitInClass($owningClassPath, $owningTraitPath);
            $this->useRelationInterfaceInEntityInterface($owningClassPath, $owningInterfacePath);
            if (\in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) {
                $this->useRelationInterfaceInEntityInterface($owningClassPath, $reciprocatingInterfacePath);
            }
            if (true === $reciprocate && \in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) {
                $inverseType = $this->getInverseHasType($hasType);
                $inverseType = $this->updateHasTypeForPossibleRequired($inverseType, $requiredReciprocation);
                $this->setEntityHasRelationToEntity(
                    $ownedEntityFqn,
                    $inverseType,
                    $owningEntityFqn,
                    /**
                     * Setting required reciprocation to false,
                     * actually it is irrelevant because reciprocation is disabled
                     */
                    false,
                    false
                );
            }
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
public function setEntityHasRelationToEntity(
        string $owningEntityFqn,
        string $hasType,
        string $ownedEntityFqn,
        bool $requiredReciprocation = false,
        bool $internalUseOnly = true
    ): void {
        $reciprocate = $internalUseOnly;
        try {
            $this->validateHasType($hasType);
            list(
                $owningTraitPath,
                $owningInterfacePath,
                $reciprocatingInterfacePath,
                ) = $this->getPathsForOwningTraitsAndInterfaces(
                    $hasType,
                    $ownedEntityFqn
                );
            list($owningClass, , $owningClassSubDirs) = $this->parseFullyQualifiedName($owningEntityFqn);
            $owningClassPath = $this->pathHelper->getPathFromNameAndSubDirs(
                $this->pathToProjectRoot,
                $owningClass,
                $owningClassSubDirs
            );
            $this->useRelationTraitInClass($owningClassPath, $owningTraitPath);
            $this->useRelationInterfaceInEntityInterface($owningClassPath, $owningInterfacePath);
            if (\in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) {
                $this->useRelationInterfaceInEntityInterface($owningClassPath, $reciprocatingInterfacePath);
            }
            if (true === $reciprocate && \in_array($hasType, self::HAS_TYPES_RECIPROCATED, true)) {
                $inverseType = $this->getInverseHasType($hasType);
                $inverseType = $this->updateHasTypeForPossibleRequired($inverseType, $requiredReciprocation);
                $this->setEntityHasRelationToEntity(
                    $ownedEntityFqn,
                    $inverseType,
                    $owningEntityFqn,
                    /**
                     * Setting required reciprocation to false,
                     * actually it is irrelevant because reciprocation is disabled
                     */
                    false,
                    false
                );
            }
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
public function setEntityHasRelationToEntity ( string $ owningEntityFqn , string $ hasType , string $ ownedEntityFqn , bool $ requiredReciprocation = false , bool $ internalUseOnly = true ) : void { $ reciprocate = $ internalUseOnly ; try { $ this -> validateHasType ( $ hasType ) ; list ( $ owningTraitPath , $ owningInterfacePath , $ reciprocatingInterfacePath , ) = $ this -> getPathsForOwningTraitsAndInterfaces ( $ hasType , $ ownedEntityFqn ) ; list ( $ owningClass , , $ owningClassSubDirs ) = $ this -> parseFullyQualifiedName ( $ owningEntityFqn ) ; $ owningClassPath = $ this -> pathHelper -> getPathFromNameAndSubDirs ( $ this -> pathToProjectRoot , $ owningClass , $ owningClassSubDirs ) ; $ this -> useRelationTraitInClass ( $ owningClassPath , $ owningTraitPath ) ; $ this -> useRelationInterfaceInEntityInterface ( $ owningClassPath , $ owningInterfacePath ) ; if ( \ in_array ( $ hasType , self :: HAS_TYPES_RECIPROCATED , true ) ) { $ this -> useRelationInterfaceInEntityInterface ( $ owningClassPath , $ reciprocatingInterfacePath ) ; } if ( true === $ reciprocate && \ in_array ( $ hasType , self :: HAS_TYPES_RECIPROCATED , true ) ) { $ inverseType = $ this -> getInverseHasType ( $ hasType ) ; $ inverseType = $ this -> updateHasTypeForPossibleRequired ( $ inverseType , $ requiredReciprocation ) ; $ this -> setEntityHasRelationToEntity ( $ ownedEntityFqn , $ inverseType , $ owningEntityFqn , /**
                     * Setting required reciprocation to false,
                     * actually it is irrelevant because reciprocation is disabled
                     */ false , false ) ; } } catch ( \ Exception $ e ) { throw new DoctrineStaticMetaException ( 'Exception in ' . __METHOD__ . ': ' . $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } }
Set a relationship from one Entity to Another Entity.

Also used internally to set the reciprocal side. Uses an undocumented 4th bool parameter to kill recursion.

@param string $owningEntityFqn
@param string $hasType
@param string $ownedEntityFqn
@param bool   $requiredReciprocation

You should never pass in this parameter, it is only used internally
@param bool   $internalUseOnly

@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Set a relationship from one Entity to Another Entity .