From d6750b27b31cad16ffef4e00a8f717b66a70ea63 Mon Sep 17 00:00:00 2001 From: Mark Sch Date: Sat, 25 Nov 2017 12:33:00 +0100 Subject: [PATCH] Fixing it the right way while maintaining theoretical BC --- src/Shell/Task/ModelTask.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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'] = [];