src/Resources/BaseDbTableResource.php
protected function updatePostRelations($table, $record, $relations, $allow_delete = false)
    {
        $schema = $this->getTableSchema(null, $table);
        $record = array_change_key_case($record, CASE_LOWER);
        foreach ($relations as $name => $relationInfo) {
            if (array_key_exists($name, $record)) {
                $relatedRecords = $record[$name];
                unset($record[$name]);
                switch ($relationInfo->type) {
                    case RelationSchema::HAS_ONE:
                        $this->assignOneToOne(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords,
                            $allow_delete
                        );
                        break;
                    case RelationSchema::HAS_MANY:
                        $this->assignManyToOne(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords,
                            $allow_delete
                        );
                        break;
                    case RelationSchema::MANY_MANY:
                        $this->assignManyToOneByJunction(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords
                        );
                        break;
                }
            }
        }
    }
protected function updatePostRelations($table, $record, $relations, $allow_delete = false)
    {
        $schema = $this->getTableSchema(null, $table);
        $record = array_change_key_case($record, CASE_LOWER);
        foreach ($relations as $name => $relationInfo) {
            if (array_key_exists($name, $record)) {
                $relatedRecords = $record[$name];
                unset($record[$name]);
                switch ($relationInfo->type) {
                    case RelationSchema::HAS_ONE:
                        $this->assignOneToOne(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords,
                            $allow_delete
                        );
                        break;
                    case RelationSchema::HAS_MANY:
                        $this->assignManyToOne(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords,
                            $allow_delete
                        );
                        break;
                    case RelationSchema::MANY_MANY:
                        $this->assignManyToOneByJunction(
                            $schema,
                            $record,
                            $relationInfo,
                            $relatedRecords
                        );
                        break;
                }
            }
        }
    }
@param string           $table
@param array            $record Record containing relationships by name if any
@param RelationSchema[] $relations
@param bool             $allow_delete

@return void
@throws BadRequestException
@throws InternalServerErrorException