Permalink
Browse files

Merge pull request #184 from trevormorse/issue_177

Fix issue #177.
  • Loading branch information...
David Coallier
David Coallier committed Aug 28, 2012
2 parents ff8ed79 + bbf4933 commit e4e818f53c1cbde02763013a9c0dce53888d2795
Showing with 8 additions and 2 deletions.
  1. +8 −2 src/frapi/admin/application/modules/default/models/Action.php
@@ -177,11 +177,17 @@ public function update(array $data, $id)
// Validate the route does not already exist and is valid
$router = new Frapi_Router();
$router->loadAndPrepareRoutes();
- if ($router->match($data['route'])) {
- throw new RuntimeException('There is already an action with this route.');
+ if ($route = $router->match($data['route'])) {
+
+ // If we match a route that is same as route we are updating,
+ // then we are ok. Otherwise there is an error
+ if ($route['action'] != $tempAction['name']) {
+ throw new RuntimeException('There is already an action with this route.');
+ }
}
}
+
$segments = Frapi_Router::parseSegments($data['route']);
foreach ($segments as $key => $value) {
if (!empty($value)) {

0 comments on commit e4e818f

Please sign in to comment.