Skip to content

Commit

Permalink
Rename trait and implement in Controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 22, 2013
1 parent 4c531ed commit 16664ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
24 changes: 2 additions & 22 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -28,6 +28,7 @@
use Cake\Utility\ClassRegistry;
use Cake\Utility\Inflector;
use Cake\Utility\MergeVariablesTrait;
use Cake\Utility\ViewVarsTrait;
use Cake\View\View;

/**
Expand Down Expand Up @@ -66,6 +67,7 @@ class Controller extends Object implements EventListener {

use MergeVariablesTrait;
use RequestActionTrait;
use ViewVarsTrait;

/**
* The name of this controller. Controller names are plural, named after the model they manipulate.
Expand Down Expand Up @@ -775,28 +777,6 @@ public function header($status) {
$this->response->header($status);
}

/**
* Saves a variable for use inside a view template.
*
* @param string|array $one A string or an array of data.
* @param string|array $two Value in case $one is a string (which then works as the key).
* Unused if $one is an associative array, otherwise serves as the values to $one's keys.
* @return void
* @link http://book.cakephp.org/2.0/en/controllers.html#interacting-with-views
*/
public function set($one, $two = null) {
if (is_array($one)) {
if (is_array($two)) {
$data = array_combine($one, $two);
} else {
$data = $one;
}
} else {
$data = array($one => $two);
}
$this->viewVars = $data + $this->viewVars;
}

/**
* Internally redirects one action to another. Does not perform another HTTP request unlike Controller::redirect()
*
Expand Down
Expand Up @@ -14,14 +14,16 @@
namespace Cake\Utility;

/**
* Provides the set() method for collecting context.
* Provides the set() method for collecting template context.
*
* Once collected context data can be passed to another object.
* This is done in Controller, TemplateTask and View for example.
*
* @package Cake.Utility
*/
trait SetContextTrait {
trait ViewVarsTrait {

public $viewVars = array();

/**
* Saves a variable for use inside a template.
Expand Down

0 comments on commit 16664ca

Please sign in to comment.