mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
making uuid field check protected
This commit is contained in:
parent
521a759911
commit
b3dba95b7d
1 changed files with 3 additions and 3 deletions
|
@ -1721,7 +1721,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
if (!empty($this->id)) {
|
if (!empty($this->id)) {
|
||||||
$success = (bool)$db->update($this, $fields, $values);
|
$success = (bool)$db->update($this, $fields, $values);
|
||||||
} else {
|
} else {
|
||||||
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->isUUID($this->primaryKey)) {
|
if (empty($this->data[$this->alias][$this->primaryKey]) && $this->_isUUID($this->primaryKey)) {
|
||||||
if (array_key_exists($this->primaryKey, $this->data[$this->alias])) {
|
if (array_key_exists($this->primaryKey, $this->data[$this->alias])) {
|
||||||
$j = array_search($this->primaryKey, $fields);
|
$j = array_search($this->primaryKey, $fields);
|
||||||
$values[$j] = String::uuid();
|
$values[$j] = String::uuid();
|
||||||
|
@ -1773,7 +1773,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
* @param string $field the field to check
|
* @param string $field the field to check
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function isUUID($field) {
|
protected function _isUUID($field) {
|
||||||
$field = $this->schema($field);
|
$field = $this->schema($field);
|
||||||
return $field['length'] == 36 && in_array($field['type'], array('string', 'binary'));
|
return $field['length'] == 36 && in_array($field['type'], array('string', 'binary'));
|
||||||
}
|
}
|
||||||
|
@ -1800,7 +1800,7 @@ class Model extends Object implements CakeEventListener {
|
||||||
$dbMulti = $db;
|
$dbMulti = $db;
|
||||||
}
|
}
|
||||||
|
|
||||||
$isUUID = !empty($this->{$join}->primaryKey) && $this->{$join}->isUUID($this->{$join}->primaryKey);
|
$isUUID = !empty($this->{$join}->primaryKey) && $this->{$join}->_isUUID($this->{$join}->primaryKey);
|
||||||
|
|
||||||
$newData = $newValues = $newJoins = array();
|
$newData = $newValues = $newJoins = array();
|
||||||
$primaryAdded = false;
|
$primaryAdded = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue