public function withParentIdAs(string $columnName)
    {
        call_user_func($this->callback, function ($idString, Table $parentTable) use ($columnName) {
            /** @var IEntityMapper $mapper */
            $mapper = call_user_func($this->mapperLoader);

            $mapper->addForeignKey(ForeignKey::createWithNamingConvention(
                $mapper->getPrimaryTableName(),
                [$columnName],
                $parentTable->getName(),
                [$parentTable->getPrimaryKeyColumnName()],
                $this->identifying
                    ? ForeignKeyMode::CASCADE
                    : ForeignKeyMode::SET_NULL,
                ForeignKeyMode::CASCADE
            ));

            return new ToOneRelation(
                $idString,
                $this->loadIds
                    ? new ToOneRelationIdentityReference($mapper, $this->bidirectionalRelationProperty)
                    : new ToOneRelationObjectReference($mapper, $this->bidirectionalRelationProperty),
                $columnName,
                $this->identifying
                    ? new IdentifyingRelationMode()
                    : new NonIdentifyingRelationMode()
            );
        });
    }
public function withParentIdAs(string $columnName)
    {
        call_user_func($this->callback, function ($idString, Table $parentTable) use ($columnName) {
            /** @var IEntityMapper $mapper */
            $mapper = call_user_func($this->mapperLoader);

            $mapper->addForeignKey(ForeignKey::createWithNamingConvention(
                $mapper->getPrimaryTableName(),
                [$columnName],
                $parentTable->getName(),
                [$parentTable->getPrimaryKeyColumnName()],
                $this->identifying
                    ? ForeignKeyMode::CASCADE
                    : ForeignKeyMode::SET_NULL,
                ForeignKeyMode::CASCADE
            ));

            return new ToOneRelation(
                $idString,
                $this->loadIds
                    ? new ToOneRelationIdentityReference($mapper, $this->bidirectionalRelationProperty)
                    : new ToOneRelationObjectReference($mapper, $this->bidirectionalRelationProperty),
                $columnName,
                $this->identifying
                    ? new IdentifyingRelationMode()
                    : new NonIdentifyingRelationMode()
            );
        });
    }
public function withParentIdAs ( string $ columnName ) { call_user_func ( $ this -> callback , function ( $ idString , Table $ parentTable ) use ( $ columnName ) { /** @var IEntityMapper $mapper */ $ mapper = call_user_func ( $ this -> mapperLoader ) ; $ mapper -> addForeignKey ( ForeignKey :: createWithNamingConvention ( $ mapper -> getPrimaryTableName ( ) , [ $ columnName ] , $ parentTable -> getName ( ) , [ $ parentTable -> getPrimaryKeyColumnName ( ) ] , $ this -> identifying ? ForeignKeyMode :: CASCADE : ForeignKeyMode :: SET_NULL , ForeignKeyMode :: CASCADE ) ) ; return new ToOneRelation ( $ idString , $ this -> loadIds ? new ToOneRelationIdentityReference ( $ mapper , $ this -> bidirectionalRelationProperty ) : new ToOneRelationObjectReference ( $ mapper , $ this -> bidirectionalRelationProperty ) , $ columnName , $ this -> identifying ? new IdentifyingRelationMode ( ) : new NonIdentifyingRelationMode ( ) ) ; } ) ; }
Sets the column name of the foreign key on the
related table.

@param string $columnName

@return void
Sets the column name of the foreign key on the related table .