weierophinney/PhlyRestfully — pull request #75 by weierophinney (2013-05-31 13:57:44+00:00)
Title: Location header is not set correctly for resource creation

I have the following routes:

```

return array(
'router' => array(
'routes' => array(
'user' => array(
'type' => 'Segment',
'options' => array(
'route' => '/users[/:userId]',
'defaults' => array(
'controller' => 'User\Controller\User',
),
),
'may_terminate' => true,
'child_routes' => array(
'address' => array(
'type' => 'Segment',
'options' => array(
'route' => '/addresses[/:addressId]',
'defaults' => array(
'controller' => 'User\Controller\UserAddress',
),
),
),
),
),
),
),
);
```

The identifier name is userId instead of id to be able to add child routes. In the UserResource onCreate method:

```
public function onCreate(ResourceEvent $e)
{
// ... some stuff here

return array('id' => $user->getId());
}
```

The HAL _self link is rendered correctly. But the code for the location header sets the route param with key "id" instead of the identifier_name which I set to "userId". That's why the location path will be "/users", instead of "/users/1" what is should be.

ResourceController.php line 353:
```
$response->getHeaders()->addHeaderLine(
'Location',
$this->halLinks()->createLink($this->route, $resource->id, $resource->resource)
);
```