src/CodeGeneration/Generator/RelationsGenerator.php
private function updateHasTypeForPossibleRequired(string $relation, bool $required): string
    {
        $inverseIsRequired = \ts\stringContains($relation, self::PREFIX_REQUIRED);
        if (false === $required) {
            if (false === $inverseIsRequired) {
                return $relation;
            }

            return $this->removeRequiredToRelation($relation);
        }
        if (true === $required) {
            if (true === $inverseIsRequired) {
                return $relation;
            }

            return $this->addRequiredToRelation($relation);
        }
    }
private function updateHasTypeForPossibleRequired(string $relation, bool $required): string
    {
        $inverseIsRequired = \ts\stringContains($relation, self::PREFIX_REQUIRED);
        if (false === $required) {
            if (false === $inverseIsRequired) {
                return $relation;
            }

            return $this->removeRequiredToRelation($relation);
        }
        if (true === $required) {
            if (true === $inverseIsRequired) {
                return $relation;
            }

            return $this->addRequiredToRelation($relation);
        }
    }
private function updateHasTypeForPossibleRequired ( string $ relation , bool $ required ) : string { $ inverseIsRequired = \ ts \ stringContains ( $ relation , self :: PREFIX_REQUIRED ) ; if ( false === $ required ) { if ( false === $ inverseIsRequired ) { return $ relation ; } return $ this -> removeRequiredToRelation ( $ relation ) ; } if ( true === $ required ) { if ( true === $ inverseIsRequired ) { return $ relation ; } return $ this -> addRequiredToRelation ( $ relation ) ; } }
Take a relationship and a possibility of being required and ensure it is set as the correct relationship

@param string $relation
@param bool   $required

@return string
Take a relationship and a possibility of being required and ensure it is set as the correct relationship