diff --git a/src/View/View.php b/src/View/View.php index d25ab738056..6a4464935b2 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -94,7 +94,7 @@ class View implements EventDispatcherInterface * * @var \Cake\View\ViewBlock */ - public $Blocks; + protected $Blocks; /** * The name of the plugin. @@ -1211,6 +1211,15 @@ public function __get($name) return $this->{$method}(); } + if ($name === 'Blocks') { + deprecationWarning( + 'View::$Blocks is protected now. ' . + 'Use one of the wrapper methods like View::fetch() etc. instead.' + ); + + return $this->Blocks; + } + $registry = $this->helpers(); if (isset($registry->{$name})) { $this->{$name} = $registry->{$name};