Wrong singular Naming conventions with parent-child routing #383

Open
sebakerckhof opened this Issue Feb 27, 2013 · 0 comments

Projects

None yet

2 participants

@sebakerckhof

I had a routing setup like this:

locations:
    type:     rest
    resource: SK\IsebaertBundle\Controller\LocationsController

devices:
    type:     rest
    parent:   locations
    resource: SK\IsebaertBundle\Controller\DevicesController

However, The LocationsController was something I adapted from the documentation (UsersController). I renamed all actions to locations, but I forgot to rename the last one, this:

    public function unlinkUserAction($slug)
    {

    } // "link_user_friend"     [UNLINK] /users/{slug}

However, symfony couldn't find routes for locations/{locationid}/devices

I had a look at the FosRestBundle routing classes, and found out the "collectionParents" map in "RestYamlCollectionLoader" had this entry: "locations" => "User"

This is because when the controller is processed, it thinks the singular name of the controller was "User" because of the one action I forgot to rename.
While one could argue whether this behavior is incorrect or not, it is confusing and not what you would expect...

@lsmith77 lsmith77 added this to the 2.0 milestone Jul 10, 2015
@lsmith77 lsmith77 modified the milestone: 2.0 Nov 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment