mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
cc0e7a6c42
commit
f5db95b22a
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue