Skip to content

Commit

Permalink
Adding temporary $View property to controller until I figure out a be…
Browse files Browse the repository at this point in the history
…tter way to provide access for it. Test case updated to reflect View not being in the registry anymore.
  • Loading branch information
markstory committed Aug 11, 2010
1 parent 07a7e18 commit d01708b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cake/libs/controller/controller.php
Expand Up @@ -212,6 +212,13 @@ class Controller extends Object {
*/
public $view = 'View';

/**
* Instance of the View created during rendering. Won't be set until after Controller::render() is called.
*
* @var View
*/
public $View;

/**
* File extension for view templates. Defaults to Cake's conventional ".ctp".
*
Expand Down Expand Up @@ -847,6 +854,7 @@ public function render($action = null, $layout = null, $file = null) {

$this->autoRender = false;
$this->output .= $View->render($action, $layout, $file);
$this->View = $View;

return $this->output;
}
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/controller/controller.test.php
Expand Up @@ -924,7 +924,7 @@ function testRender() {
ClassRegistry::flush();
$Controller->viewPath = 'posts';
$result = $Controller->render('index');
$View = ClassRegistry::getObject('view');
$View = $Controller->View;
$this->assertTrue(isset($View->validationErrors['ControllerComment']));
$this->assertEqual($expected, $View->validationErrors['ControllerComment']);

Expand Down

0 comments on commit d01708b

Please sign in to comment.