Route conflict in group


#1

Hey Guys,

Can anyone explain why the following throws the error:

Cannot register two routes matching “/api/public/forumthread/([^/]+)” for method “PUT”

$app->group(’/api/public/forumthread’, function () {

$this->put(’/{id}’, function ($request, $response, $args) {
$model = ForumThread::find($args[‘id’]);
$data = $request->getParsedBody();
$model->fill($data);
$model->save();
return $response->withJson($model->toArray());
});

});

It worked in Slim 2.

Cheers,
sn0rcha


#2

That looks okay to me, and I when I copy/paste that into my routes definitions I don’t get any error. (I didn’t try it further, but I don’t get an error.) So I suspect you might have a route entry elsewhere that is somehow conflicting.