public function withRelatedIdAs(string $columnName)
    {
        call_user_func($this->callback,
                function ($idString, Table $parentTable) use ($columnName) {
                    $mapper = call_user_func($this->mapperLoader);

                    return new ManyToOneRelation(
                            $idString,
                            $this->loadIds
                                    ? new ToOneRelationIdentityReference($mapper, $this->bidirectionalRelationProperty)
                                    : new ToOneRelationObjectReference($mapper, $this->bidirectionalRelationProperty),
                            $parentTable,
                            $columnName
                    );
                },
                // Dont create foreign key if bidirectional property is set
                // because it will be created by the inverse bidirectional relation
                /** @see OneToManyRelationDefiner::withParentIdAs() */
                /** @see ToOneRelationDefiner::withParentIdAs() */
                $this->bidirectionalRelationProperty ? null : function (Table $parentTable) use ($columnName) {
                    /** @var IEntityMapper $mapper */
                    $mapper = call_user_func($this->mapperLoader);

                    return ForeignKey::createWithNamingConvention(
                            $parentTable->getName(),
                            [$columnName],
                            $mapper->getPrimaryTableName(),
                            [$mapper->getPrimaryTable()->getPrimaryKeyColumnName()],
                            $this->onDeleteMode,
                            ForeignKeyMode::CASCADE
                    );
                });
    }
public function withRelatedIdAs(string $columnName)
    {
        call_user_func($this->callback,
                function ($idString, Table $parentTable) use ($columnName) {
                    $mapper = call_user_func($this->mapperLoader);

                    return new ManyToOneRelation(
                            $idString,
                            $this->loadIds
                                    ? new ToOneRelationIdentityReference($mapper, $this->bidirectionalRelationProperty)
                                    : new ToOneRelationObjectReference($mapper, $this->bidirectionalRelationProperty),
                            $parentTable,
                            $columnName
                    );
                },
                // Dont create foreign key if bidirectional property is set
                // because it will be created by the inverse bidirectional relation
                /** @see OneToManyRelationDefiner::withParentIdAs() */
                /** @see ToOneRelationDefiner::withParentIdAs() */
                $this->bidirectionalRelationProperty ? null : function (Table $parentTable) use ($columnName) {
                    /** @var IEntityMapper $mapper */
                    $mapper = call_user_func($this->mapperLoader);

                    return ForeignKey::createWithNamingConvention(
                            $parentTable->getName(),
                            [$columnName],
                            $mapper->getPrimaryTableName(),
                            [$mapper->getPrimaryTable()->getPrimaryKeyColumnName()],
                            $this->onDeleteMode,
                            ForeignKeyMode::CASCADE
                    );
                });
    }
public function withRelatedIdAs ( string $ columnName ) { call_user_func ( $ this -> callback , function ( $ idString , Table $ parentTable ) use ( $ columnName ) { $ mapper = call_user_func ( $ this -> mapperLoader ) ; return new ManyToOneRelation ( $ idString , $ this -> loadIds ? new ToOneRelationIdentityReference ( $ mapper , $ this -> bidirectionalRelationProperty ) : new ToOneRelationObjectReference ( $ mapper , $ this -> bidirectionalRelationProperty ) , $ parentTable , $ columnName ) ; } , // Dont create foreign key if bidirectional property is set // because it will be created by the inverse bidirectional relation /** @see OneToManyRelationDefiner::withParentIdAs() */ /** @see ToOneRelationDefiner::withParentIdAs() */ $ this -> bidirectionalRelationProperty ? null : function ( Table $ parentTable ) use ( $ columnName ) { /** @var IEntityMapper $mapper */ $ mapper = call_user_func ( $ this -> mapperLoader ) ; return ForeignKey :: createWithNamingConvention ( $ parentTable -> getName ( ) , [ $ columnName ] , $ mapper -> getPrimaryTableName ( ) , [ $ mapper -> getPrimaryTable ( ) -> getPrimaryKeyColumnName ( ) ] , $ this -> onDeleteMode , ForeignKeyMode :: CASCADE ) ; } ) ; }
Sets the column name of the foreign key on the parent table.

@param string $columnName

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