Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

$this->request->type confusion in Controller::_init #354

Merged
merged 1 commit into from

2 participants

@rmarscher

Much thanks to @nateabele for clarifying #347. This commit simply makes it a little more obvious that Controller::_init is looking for a param named 'type' in the request object and not a mistyped instance var or method.

Basically, what happened was led to it was this -

I was looking at Controller::_init to see how I could set the _render['type'] from somewhere in the bootstrap. I saw $this->request->type, so I set $request->type = 'something' in my bootstrap, but it didn't work (because $request->params['type'] was set and I didn't realize it was taking precedence via Controller::__get()). So then I looked at lithium\action\Request and its parent classes and found that there was $_type and type() but no $type which led me to think it was a typo.

So anyway, to prevent that from happening to anyone else, I think this slight change should help make it clear.

@rmarscher rmarscher making it slightly more obvious that Controller::_init is looking for…
… a param named 'type' in the request object and not a mistyped instance var or method
4ba3b92
@nateabele nateabele merged commit 48801a3 into UnionOfRAD:master
@nateabele
Owner

Looks like I'm gonna have to back this out, as it currently breaks some things. See here: http://travis-ci.org/#!/UnionOfRAD/lithium/builds/726396

Btw, next time do me a favor and send pull requests to the dev branch.

@rmarscher

So sorry, Nate.

@nateabele
Owner

@rmarscher YOU SHOULD BE SORRY, THIS IS UNACCEPTABLE.

Kidding, no worries dude. That's why we have a build server. Going forward though, submit pull requests against the dev branch so we can keep master clean. Thanks man.

@nateabele
Owner

Oh, never mind, I already mentioned that.

@rmarscher

And I already submitted a new pull to the dev branch. Thx.

@nateabele
Owner

Yeah, clearly I'm on top of things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 22, 2012
  1. @rmarscher

    making it slightly more obvious that Controller::_init is looking for…

    rmarscher authored
    … a param named 'type' in the request object and not a mistyped instance var or method
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  action/Controller.php
View
2  action/Controller.php
@@ -144,7 +144,7 @@ protected function _init() {
$this->_render['type'] = $this->request->accepts();
return;
}
- $this->_render['type'] = $this->request->type ?: 'html';
+ $this->_render['type'] = $this->request->get('param:type') ?: 'html';
}
/**
Something went wrong with that request. Please try again.