fixes #4119, refs #6151 binary uuid

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8070 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2009-03-03 16:33:17 +00:00
parent 79cba70758
commit 088815834e

View file

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