diff --git a/src/Controller/Component/CRUDComponent.php b/src/Controller/Component/CRUDComponent.php index e6d6f6c..9330740 100644 --- a/src/Controller/Component/CRUDComponent.php +++ b/src/Controller/Component/CRUDComponent.php @@ -526,10 +526,10 @@ class CRUDComponent extends Component if (!empty($errors)) { if (count($errors) == 1) { $field = array_keys($errors)[0]; - $fieldError = implode(', ', array_values($errors[$field])); + $fieldError = json_encode($errors[$field]); $validationMessage = __('{0}: {1}', $field, $fieldError); } else { - $validationMessage = __('There has been validation issues with multiple fields'); + $validationMessage = __('There has been validation issues with multiple fields: {0}', json_encode($errors)); } } return $validationMessage; diff --git a/src/Model/Table/UsersTable.php b/src/Model/Table/UsersTable.php index ddccff6..14c4750 100644 --- a/src/Model/Table/UsersTable.php +++ b/src/Model/Table/UsersTable.php @@ -111,7 +111,6 @@ class UsersTable extends AppTable } } } - if (!$enabled && !empty($entity->_metafields_to_delete)) { foreach ($entity->_metafields_to_delete as $metaFieldToDelete) { if ($metaFieldToDelete['field'] === $permission_name) { @@ -120,7 +119,7 @@ class UsersTable extends AppTable } } - if ($valueToCompareTo > $permission_data['limit']) { + if ($enabled && $valueToCompareTo > $permission_data['limit']) { return [ $permission_name => __( @@ -202,7 +201,7 @@ class UsersTable extends AppTable foreach ($permissionRestrictionCheck as $permission_name => $errors) { foreach ($entity->meta_fields as $i => $metaField) { if ($metaField['field'] === $permission_name) { - $entity->meta_fields[$i]->setErrors(['value' => $errors]); + $entity->setErrors(['meta_fields' => [$permission_name => $errors]]); } } }