From 68487baf4717c71624a46f59306af8baa96e509c Mon Sep 17 00:00:00 2001 From: phpnut Date: Wed, 9 Jan 2008 04:50:08 +0000 Subject: [PATCH] "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 --- cake/libs/model/model.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index fd2bcef57..c13868420 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -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])) {