Browse Source

Remove deprecated calls in Cake\Validator and Cake\View

Anthony GRASSIOT 9 years ago
parent
commit
7678f94a23

+ 3 - 3
src/Validation/Validator.php

@@ -379,7 +379,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
                 return false;
             }
             foreach ($this->providers() as $provider) {
-                $validator->provider($provider, $this->provider($provider));
+                $validator->setProvider($provider, $this->getProvider($provider));
             }
             $errors = $validator->errors($value, $context['newRecord']);
 
@@ -414,7 +414,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
                 return false;
             }
             foreach ($this->providers() as $provider) {
-                $validator->provider($provider, $this->provider($provider));
+                $validator->setProvider($provider, $this->getProvider($provider));
             }
             $errors = [];
             foreach ($value as $i => $row) {
@@ -1775,7 +1775,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
     {
         $errors = [];
         // Loading default provider in case there is none
-        $this->provider('default');
+        $this->getProvider('default');
         $message = 'The provided value is invalid';
 
         if ($this->_useI18n) {

+ 1 - 1
src/Validation/ValidatorAwareTrait.php

@@ -115,7 +115,7 @@ trait ValidatorAwareTrait
             }
         }
 
-        $validator->provider(self::VALIDATOR_PROVIDER_NAME, $this);
+        $validator->setProvider(self::VALIDATOR_PROVIDER_NAME, $this);
 
         return $this->_validators[$name] = $validator;
     }

+ 5 - 5
src/View/Cell.php

@@ -196,17 +196,17 @@ abstract class Cell
                 $template = Inflector::underscore($template);
             }
             if ($template === null) {
-                $template = $builder->template() ?: $this->template;
+                $template = $builder->getTemplate() ?: $this->template;
             }
-            $builder->layout(false)
-                ->template($template);
+            $builder->setLayout(false)
+                ->setTemplate($template);
 
             $className = get_class($this);
             $namePrefix = '\View\Cell\\';
             $name = substr($className, strpos($className, $namePrefix) + strlen($namePrefix));
             $name = substr($name, 0, -4);
-            if (!$builder->templatePath()) {
-                $builder->templatePath('Cell' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $name));
+            if (!$builder->getTemplatePath()) {
+                $builder->setTemplatePath('Cell' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $name));
             }
 
             $this->View = $this->createView();

+ 6 - 6
src/View/CellTrait.php

@@ -98,31 +98,31 @@ trait CellTrait
 
         $builder = $instance->viewBuilder();
         if (!empty($plugin)) {
-            $builder->plugin($plugin);
+            $builder->setPlugin($plugin);
         }
         if (!empty($this->helpers)) {
-            $builder->helpers($this->helpers);
+            $builder->setHelpers($this->helpers);
             $instance->helpers = $this->helpers;
         }
 
         if ($this instanceof View) {
             if (!empty($this->theme)) {
-                $builder->theme($this->theme);
+                $builder->setTheme($this->theme);
             }
 
             $class = get_class($this);
-            $builder->className($class);
+            $builder->setClassName($class);
             $instance->viewClass = $class;
 
             return $instance;
         }
 
         if (method_exists($this, 'viewBuilder')) {
-            $builder->theme($this->viewBuilder()->theme());
+            $builder->setTheme($this->viewBuilder()->theme());
         }
 
         if (isset($this->viewClass)) {
-            $builder->className($this->viewClass);
+            $builder->getClassName($this->viewClass);
             $instance->viewClass = $this->viewClass;
         }
 

+ 2 - 2
src/View/Helper/FormHelper.php

@@ -953,7 +953,7 @@ class FormHelper extends Helper
                 continue;
             }
 
-            $out .= $this->input($name, (array)$opts);
+            $out .= $this->control($name, (array)$opts);
         }
 
         return $this->fieldset($out, $options);
@@ -2731,7 +2731,7 @@ class FormHelper extends Helper
      */
     public function resetTemplates()
     {
-        $this->templates($this->_defaultConfig['templates']);
+        $this->setTemplates($this->_defaultConfig['templates']);
     }
 
     /**

+ 2 - 2
src/View/JsonView.php

@@ -111,8 +111,8 @@ class JsonView extends SerializedView
             if ($this->viewVars['_jsonp'] === true) {
                 $jsonpParam = 'callback';
             }
-            if ($this->request->query($jsonpParam)) {
-                $return = sprintf('%s(%s)', h($this->request->query($jsonpParam)), $return);
+            if ($this->request->getQuery($jsonpParam)) {
+                $return = sprintf('%s(%s)', h($this->request->getQuery($jsonpParam)), $return);
                 $this->response->type('js');
             }
         }

+ 4 - 4
src/View/ViewVarsTrait.php

@@ -70,11 +70,11 @@ trait ViewVarsTrait
     public function createView($viewClass = null)
     {
         $builder = $this->viewBuilder();
-        if ($viewClass === null && $builder->className() === null) {
-            $builder->className($this->viewClass);
+        if ($viewClass === null && $builder->getClassName() === null) {
+            $builder->setClassName($this->viewClass);
         }
         if ($viewClass) {
-            $builder->className($viewClass);
+            $builder->setClassName($viewClass);
         }
 
         $validViewOptions = $this->viewOptions();
@@ -109,7 +109,7 @@ trait ViewVarsTrait
                 $builder->{$prop}($this->{$prop});
             }
         }
-        $builder->options($viewOptions);
+        $builder->setOptions($viewOptions);
 
         return $builder->build(
             $this->viewVars,