diff --git a/src/Propel/Generator/Builder/Om/ObjectBuilder.php b/src/Propel/Generator/Builder/Om/ObjectBuilder.php index 65ef45f0c7..55c3aff211 100644 --- a/src/Propel/Generator/Builder/Om/ObjectBuilder.php +++ b/src/Propel/Generator/Builder/Om/ObjectBuilder.php @@ -6609,16 +6609,18 @@ protected function addDoInsertBodyRaw() } catch (Exception \$e) { throw new PropelException('Unable to get autoincrement id.', 0, \$e); }"; - $column = $table->getFirstPrimaryKeyColumn(); - if ($column) { + foreach ($table->getPrimaryKey() as $col) { + if (!$col->isAutoIncrement()) { + continue; + } if ($table->isAllowPkInsert()) { $script .= " if (\$pk !== null) { - \$this->set" . $column->getPhpName() . "(\$pk); + \$this->set" . $col->getPhpName() . "(\$pk); }"; } else { $script .= " - \$this->set" . $column->getPhpName() . '($pk);'; + \$this->set" . $col->getPhpName() . '($pk);'; } } $script .= "