Skip to content

Commit

Permalink
added some deprecation warnings for 2.0.x users
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 6, 2014
1 parent 402ad55 commit ae65689
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/Application/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,22 @@ public function getPresenterFactory()
return $this->presenterFactory;
}


/********************* request serialization ****************d*g**/


/** @deprecated */
function storeRequest($expiration = '+ 10 minutes')
{
trigger_error(__METHOD__ . '() is deprecated; use $presenter->storeRequest() instead.', E_USER_DEPRECATED);
return $this->presenter->storeRequest($expiration);
}

/** @deprecated */
function restoreRequest($key)
{
trigger_error(__METHOD__ . '() is deprecated; use $presenter->restoreRequest() instead.', E_USER_DEPRECATED);
return $this->presenter->restoreRequest($key);
}

}
14 changes: 14 additions & 0 deletions src/Application/UI/Presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,10 @@ public function sendResponse(Application\IResponse $response)
*/
public function terminate()
{
if (func_num_args() !== 0) {
trigger_error(__METHOD__ . ' is not intended to send a Application\Response; use sendResponse() instead.', E_USER_WARNING);
$this->sendResponse(func_get_arg(0));
}
throw new Application\AbortException();
}

Expand Down Expand Up @@ -1333,6 +1337,16 @@ public function getContext()
}


/**
* @deprecated
*/
final public function getService($name)
{
trigger_error(__METHOD__ . '() is deprecated; use dependency injection instead.', E_USER_DEPRECATED);
return $this->context->getService($name);
}


/**
* @return Nette\Http\IRequest
*/
Expand Down
6 changes: 5 additions & 1 deletion src/Application/UI/PresenterComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ public function saveState(array & $params, $reflection = NULL)
*/
public function getParameter($name, $default = NULL)
{
if (isset($this->params[$name])) {
if (func_num_args() === 0) {
trigger_error('Calling ' . __METHOD__ . ' with no arguments to get all parameters is deprecated, use getParameters() instead.', E_USER_DEPRECATED);
return $this->params;

} elseif (isset($this->params[$name])) {
return $this->params[$name];

} else {
Expand Down

0 comments on commit ae65689

Please sign in to comment.