From bec52da76abdb10420f58a6b0728c2cf1b0269c7 Mon Sep 17 00:00:00 2001 From: David Yell Date: Tue, 4 Apr 2017 12:09:30 +0100 Subject: [PATCH] Use the new accessor methods Updated to reflect changes made in the latest release of the framework with accessor methods. --- en/core-libraries/validation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/en/core-libraries/validation.rst b/en/core-libraries/validation.rst index 245ceb4e04..fd81fb53d5 100644 --- a/en/core-libraries/validation.rst +++ b/en/core-libraries/validation.rst @@ -168,16 +168,16 @@ Validator instances come with a 'default' provider setup automatically. The default provider is mapped to the :php:class:`~Cake\\Validation\\Validation` class. This makes it simple to use the methods on that class as validation rules. When using Validators and the ORM together, additional providers are -configured for the table and entity objects. You can use the ``provider()`` +configured for the table and entity objects. You can use the ``setProvider()`` method to add any additional providers your application needs:: $validator = new Validator(); // Use an object instance. - $validator->provider('custom', $myObject); + $validator->setProvider('custom', $myObject); // Use a class name. Methods must be static. - $validator->provider('custom', 'App\Model\Validation'); + $validator->setProvider('custom', 'App\Model\Validation'); Validation providers can be objects, or class names. If a class name is used the methods must be static. To use a provider other than 'default', be sure to set @@ -203,7 +203,7 @@ model fields, depending on a country, ie:: public function validationDefault(Validator $validator) { // add the provider to the validator - $validator->provider('fr', 'Localized\Validation\FrValidation'); + $validator->setProvider('fr', 'Localized\Validation\FrValidation'); // use the provider in a field validation rule $validator->add('phoneField', 'myCustomRuleNameForPhone', [ 'rule' => 'phone',