diff --git a/src/Shell/Task/ModelTask.php b/src/Shell/Task/ModelTask.php index ef11c4c35..1b58ddfe9 100644 --- a/src/Shell/Task/ModelTask.php +++ b/src/Shell/Task/ModelTask.php @@ -694,7 +694,7 @@ public function getValidation($model, $associations = []) * @param array $primaryKey The primary key field * @return array Array of validation for the field. */ - public function fieldValidation($schema, $fieldName, array $metaData, array $primaryKey) + public function fieldValidation($schema, $fieldName, array $metaData, $primaryKey) { $ignoreFields = ['lft', 'rght', 'created', 'modified', 'updated']; if (in_array($fieldName, $ignoreFields)) { @@ -731,7 +731,7 @@ public function fieldValidation($schema, $fieldName, array $metaData, array $pri } } - if (in_array($fieldName, $primaryKey)) { + if (in_array($fieldName, (array)$primaryKey)) { $rules['allowEmpty'] = ['create']; } elseif ($metaData['null'] === true) { $rules['allowEmpty'] = [];