-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them
Description
From #8079 (comment)
The name key is contacts.just.friends.*.name, not contacts.*.name.
public function index(): string
{
// Extend the user guide case and add one more layer.
$requestData = [
'contacts' => [
'name' => 'Joe Smith',
'just' => [
'friends' => [
[
'name' => 'Fred Flinstone',
],
[
'name' => 'Wilma',
],
],
],
],
];
$this->validator = \Config\Services::validation();
$this->validator->setRules([
'contacts.*.name' => 'required|max_length[1]',
]);
dd(
$this->validator->run($requestData),
$this->validator->getErrors(),
$this->validator->getValidated()
);
}$this->validator->run(...) boolean false
⧉⌕$this->validator->getErrors() array (2)
⇄contacts.just.friends.0.name => string (63) "The contacts.*.name field cannot exceed 1 characters in length."
⇄contacts.just.friends.1.name => string (63) "The contacts.*.name field cannot exceed 1 characters in length."
$this->validator->getValidated() array (0)
⧉ Called from .../app/Controllers/Home.php:34 [dd()]
Metadata
Metadata
Assignees
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them