The Symfony routing prevents the "parent" attribute from being set through validation and an exception is thrown.
Can you give me an example here?
It seems, that you're trying to load restful route inside default routing configuration. In order to be able to use parent and other rest-specific parameters - you need to move such configs into restful collection.
This is wrong:
# app/config/routing.yml
users:
type: rest
resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController
user_topics:
type: rest
resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
parent: users
But this is correct:
# app/config/routing.yml
users:
type: rest
resource: path/to/your/bundle/routing.yml
# path/to/your/bundle/routing.yml
users:
type: rest
resource: FOS\RestBundle\Tests\Fixtures\Controller\UsersController
user_topics:
type: rest
resource: FOS\RestBundle\Tests\Fixtures\Controller\UserTopicsController
parent: users
note that you can also load the main file with the type rest by defining the type in your router configuration
Most helpful comment
It seems, that you're trying to load
restfulroute inside default routing configuration. In order to be able to useparentand otherrest-specific parameters - you need to move such configs intorestfulcollection.This is wrong:
But this is correct: