Skip to content

Commit

Permalink
Remove backwards compatibility shim for 1.x/2.x
Browse files Browse the repository at this point in the history
The overloaded properties removed were added in 2.x to ease upgrading
from 1.x.  Remove them now as they have been deprecated for a long time.
  • Loading branch information
markstory committed Oct 9, 2012
1 parent 91200dd commit 923a1f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
15 changes: 1 addition & 14 deletions lib/Cake/Test/TestCase/View/ViewTest.php
Expand Up @@ -224,7 +224,7 @@ public function beforeLayout($viewFile) {
* @return void
*/
public function afterLayout($layoutFile) {
$this->_View->output .= 'modified in the afterlife';
$this->_View->append('content', 'modified in the afterlife');
}

}
Expand Down Expand Up @@ -1465,19 +1465,6 @@ public function testPropertySetting() {
$this->assertEquals('test', $this->View->pageTitle);
}

/**
* Test that setting arbitrary properties still works.
*
* @return void
*/
public function testPropertySettingMagicGet() {
$this->assertFalse(isset($this->View->action));
$this->View->request->params['action'] = 'login';
$this->assertEquals('login', $this->View->action);
$this->assertTrue(isset($this->View->action));
$this->assertTrue(!empty($this->View->action));
}

/**
* test memory leaks that existed in _paths at one point.
*
Expand Down
27 changes: 2 additions & 25 deletions lib/Cake/View/View.php
Expand Up @@ -781,25 +781,12 @@ public function set($one, $two = null) {
}

/**
* Magic accessor for helpers. Provides access to attributes that were deprecated.
* Magic accessor for helpers.
*
* @param string $name Name of the attribute to get.
* @return mixed
*/
public function __get($name) {
switch ($name) {
case 'base':
case 'here':
case 'webroot':
case 'data':
return $this->request->{$name};
case 'action':
return $this->request->params['action'];
case 'params':
return $this->request;
case 'output':
return $this->Blocks->get('content');
}
if (isset($this->Helpers->{$name})) {
$this->{$name} = $this->Helpers->{$name};
return $this->Helpers->{$name};
Expand All @@ -815,12 +802,7 @@ public function __get($name) {
* @return mixed
*/
public function __set($name, $value) {
switch ($name) {
case 'output':
return $this->Blocks->set('content', $value);
default:
$this->{$name} = $value;
}
$this->{$name} = $value;
}

/**
Expand All @@ -833,10 +815,6 @@ public function __isset($name) {
if (isset($this->{$name})) {
return true;
}
$magicGet = array('base', 'here', 'webroot', 'data', 'action', 'params', 'output');
if (in_array($name, $magicGet)) {
return $this->__get($name) !== null;
}
return false;
}

Expand Down Expand Up @@ -891,7 +869,6 @@ protected function _render($viewFile, $data = array()) {
if ($initialBlocks !== $remainingBlocks) {
throw new Error\Exception(__d('cake_dev', 'The "%s" block was left open. Blocks are not allowed to cross files.', $this->Blocks->active()));
}

return $content;
}

Expand Down

0 comments on commit 923a1f1

Please sign in to comment.