Allow null value for route name in PRG plugin #2242

Merged
merged 2 commits into from Aug 28, 2012

Projects

None yet

2 participants

@juriansluiman

In a lot of PRG patterns the POST request happens to the same url as the GET request. This PR keeps the flexibility to set the route name but it also defaults to the currently matched route name.

Previously I did:

$route = $this->getEvent()->getRouteMatch()->getMatchedRouteName();

if (($result = $this->prg($route)) instanceof Response) {
    return $result;
}  elseif (false !== $result) {
    // Do stuff
}

Where now you're able to:

if (($result = $this->prg()) instanceof Response) {
    return $result;
}  elseif (false !== $result) {
    // Do stuff
}

Test is made to assert the behaviour.

Jurian Sluiman added some commits Aug 26, 2012
Jurian Sluiman When redirect string is null, use current route
In a lot of PRG patterns the POST request happens to the same url
as the GET request. It keeps the flexibility to set the route name
but it also defaults to the current matched route name.
9c7181a
Jurian Sluiman Create test to assert null redirect value is allowed 9799715
@weierophinney weierophinney added a commit that referenced this pull request Aug 28, 2012
@weierophinney weierophinney [#2242] Updated README
- Detailed the null route
38ac5e1
@weierophinney weierophinney merged commit 9799715 into zendframework:master Aug 28, 2012
@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney [#2242] Updated README
- Detailed the null route
e455e27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment