Fixes #3140, UUID char(36) primary key double insert bug

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5625 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-09-10 12:06:53 +00:00
parent 7fe576f122
commit fdc575b107

View file

@ -1080,7 +1080,7 @@ class Model extends Overloadable {
} else { } else {
foreach ($this->_tableInfo->value as $key => $value) { foreach ($this->_tableInfo->value as $key => $value) {
if(in_array($this->primaryKey, $value)) { if(in_array($this->primaryKey, $value)) {
if($this->_tableInfo->value[$key]['type'] === 'string' && $this->_tableInfo->value[$key]['length'] === 36) { if (empty($this->data[$this->name][$this->primaryKey]) && $this->_tableInfo->value[$key]['type'] === 'string' && $this->_tableInfo->value[$key]['length'] === 36) {
$fields[] = $this->primaryKey; $fields[] = $this->primaryKey;
$values[] = String::uuid(); $values[] = String::uuid();
} }