Applied patch by 'jose_zap' for supporting binary uuid primary keys, fixes #4119

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6945 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
the_undefined 2008-05-19 05:08:37 +00:00
parent cc0e7a6c42
commit f5db95b22a

View file

@ -1134,7 +1134,9 @@ class Model extends Overloadable {
} else {
foreach ($this->_schema as $field => $properties) {
if ($this->primaryKey === $field) {
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->_schema[$field]['type'] === 'string' && $this->_schema[$field]['length'] === 36) {
$isUUID = ($this->_schema[$field]['type'] === 'string' && $this->_schema[$field]['length'] === 36)
|| ($this->_schema[$field]['type'] === 'binary' && $this->_schema[$field]['length'] === 16);
if (empty($this->data[$this->alias][$this->primaryKey]) && $isUUID) {
list($fields[], $values[]) = array($this->primaryKey, String::uuid());
}
break;