mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
parent
1ded0c21dd
commit
50b3893e65
2 changed files with 7 additions and 3 deletions
|
@ -3302,8 +3302,12 @@ class Model extends Object implements CakeEventListener {
|
||||||
*/
|
*/
|
||||||
public function isUnique($fields, $or = true) {
|
public function isUnique($fields, $or = true) {
|
||||||
if (is_array($or)) {
|
if (is_array($or)) {
|
||||||
$isAssociative = count(array_filter(array_keys($or), 'is_string'));
|
$isRule = (
|
||||||
if (!$isAssociative) {
|
array_key_exists('rule', $or) &&
|
||||||
|
array_key_exists('required', $or) &&
|
||||||
|
array_key_exists('message', $or)
|
||||||
|
);
|
||||||
|
if (!$isRule) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$fields = $args[1];
|
$fields = $args[1];
|
||||||
$or = isset($args[2]) ? $args[2] : true;
|
$or = isset($args[2]) ? $args[2] : true;
|
||||||
|
|
|
@ -2450,7 +2450,7 @@ class ModelValidationTest extends BaseModelTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test backward compatibility of the isUnique method when used as a validator for multiple fields.
|
* Test backward compatibility of the isUnique method when used as a validator for a single field.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue