Skip to content

Commit

Permalink
Remove deprecated calls in Cake\Validator and Cake\View
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot committed Jan 11, 2017
1 parent cce7909 commit 7678f94
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/Validation/Validator.php
Expand Up @@ -379,7 +379,7 @@ public function addNested($field, Validator $validator)
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']);

Expand Down Expand Up @@ -414,7 +414,7 @@ public function addNestedMany($field, Validator $validator)
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) {
Expand Down Expand Up @@ -1775,7 +1775,7 @@ protected function _processRules($field, ValidationSet $rules, $data, $newRecord
{
$errors = [];
// Loading default provider in case there is none
$this->provider('default');
$this->getProvider('default');
$message = 'The provided value is invalid';

if ($this->_useI18n) {
Expand Down
2 changes: 1 addition & 1 deletion src/Validation/ValidatorAwareTrait.php
Expand Up @@ -115,7 +115,7 @@ public function validator($name = null, Validator $validator = null)
}
}

$validator->provider(self::VALIDATOR_PROVIDER_NAME, $this);
$validator->setProvider(self::VALIDATOR_PROVIDER_NAME, $this);

return $this->_validators[$name] = $validator;
}
Expand Down
10 changes: 5 additions & 5 deletions src/View/Cell.php
Expand Up @@ -196,17 +196,17 @@ public function render($template = null)
$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();
Expand Down
12 changes: 6 additions & 6 deletions src/View/CellTrait.php
Expand Up @@ -98,31 +98,31 @@ protected function _createCell($className, $action, $plugin, $options)

$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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/View/Helper/FormHelper.php
Expand Up @@ -953,7 +953,7 @@ public function controls(array $fields, array $options = [])
continue;
}

$out .= $this->input($name, (array)$opts);
$out .= $this->control($name, (array)$opts);
}

return $this->fieldset($out, $options);
Expand Down Expand Up @@ -2731,7 +2731,7 @@ public function widget($name, array $data = [])
*/
public function resetTemplates()
{
$this->templates($this->_defaultConfig['templates']);
$this->setTemplates($this->_defaultConfig['templates']);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/View/JsonView.php
Expand Up @@ -111,8 +111,8 @@ public function render($view = null, $layout = null)
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');
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/View/ViewVarsTrait.php
Expand Up @@ -70,11 +70,11 @@ public function viewBuilder()
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();
Expand Down Expand Up @@ -109,7 +109,7 @@ public function createView($viewClass = null)
$builder->{$prop}($this->{$prop});
}
}
$builder->options($viewOptions);
$builder->setOptions($viewOptions);

return $builder->build(
$this->viewVars,
Expand Down

0 comments on commit 7678f94

Please sign in to comment.