Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0 suggestion for ViewVarsTrait set method return #5318

Closed
SplicePHP opened this issue Dec 3, 2014 · 4 comments
Closed

3.0 suggestion for ViewVarsTrait set method return #5318

SplicePHP opened this issue Dec 3, 2014 · 4 comments

Comments

@SplicePHP
Copy link
Contributor

Currently the Cake\View\ViewVarsTrait::set method returns void.
It might be a good idea to return $this instead of void
Here is a use case
If I am using a cell and want to set a couple of variables it makes the code much less verbose:

  echo $this->cell('Cell::method', ....)->set('key1', 'value1')->set('key2', 'value2');

instead of:

  $cell = $this->cell('Cell::method', ....);
  $cell->set('key1', 'value1');
  $cell->set('key2', 'value2');
  echo $cell;
@markstory markstory added this to the 3.0.0 milestone Dec 3, 2014
@markstory
Copy link
Member

Seems reasonable to me.

@markstory
Copy link
Member

Did you know that set() can also take an array of properties to set?

@dereuromark
Copy link
Member

Yeah, sounds good to let it chain by default.

@dereuromark
Copy link
Member

Closing as a PR is now open for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants