"Fixes #3854, Scaffolding is generating an id field with an empty value for auto_increment primary key"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6345 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2008-01-09 04:50:08 +00:00
parent 04934fdb2f
commit 68487baf47

View file

@ -1172,6 +1172,10 @@ class Model extends Overloadable {
}
$fields = $values = array();
if (isset($this->data[$this->alias][$this->primaryKey]) && empty($this->data[$this->alias][$this->primaryKey])) {
unset($this->data[$this->alias][$this->primaryKey]);
}
foreach ($this->data as $n => $v) {
if (isset($this->hasAndBelongsToMany[$n])) {
if (isset($v[$n])) {