Skip to content
Permalink
Browse files

Fix deprecation warning text in ViewVarsTrait.

Don't suggest method names that will fail.

Refs #7468
  • Loading branch information...
markstory committed Sep 29, 2015
1 parent c9642e6 commit 4ec895b7003eab18737d0b07aadea2f55021b83a
Showing with 14 additions and 7 deletions.
  1. +14 −7 src/View/ViewVarsTrait.php
@@ -86,15 +86,22 @@ public function createView($viewClass = null)
$viewOptions[$option] = $this->{$option};
}
}
$deprecatedOptions = ['layout', 'view', 'theme', 'autoLayout', 'viewPath', 'layoutPath'];
foreach ($deprecatedOptions as $option) {
if (property_exists($this, $option)) {
$method = $option === 'viewPath' ? 'templatePath' : $option;
$builder->{$method}($this->{$option});
$deprecatedOptions = [
'layout' => 'layout',
'view' => 'template',
'theme' => 'theme',
'autoLayout' => 'autoLayout',
'viewPath' => 'templatePath',
'layoutPath' => 'layoutPath',
];
foreach ($deprecatedOptions as $old => $new) {
if (property_exists($this, $old)) {
$builder->{$new}($this->{$old});
trigger_error(sprintf(
'Property $%s is deprecated. Use $this->viewBuilder()->%s() instead in beforeRender().',
$option,
$method
$old,
$new
), E_USER_DEPRECATED);
}
}

0 comments on commit 4ec895b

Please sign in to comment.
You can’t perform that action at this time.