Skip to content

Commit

Permalink
improve route loader upgrade instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobion committed Jun 4, 2020
1 parent cc53e99 commit 6571903
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,34 @@ CHANGELOG
routing_loader: false
```

You need to configure your routes explicitly or consider using the
[RestRoutingBundle](https://github.com/handcraftedinthealps/RestRoutingBundle).
You need to configure your routes explicitly, e.g. using the Symfony Core annotations or the FOSRestBundle
shortcuts like `FOS\RestBundle\Controller\Annotations\Get`. You can use
`bin/console debug:router --show-controllers` to help with the migration and compare routes before and after it.
Change the routing loading:

Before:
```
Acme\Controller\TestController:
type: rest
resource: Acme\Controller\TestController
```

After:
```
Acme\Controller\TestController:
type: annotation
resource: Acme\Controller\TestController
```

When using the Symfony Core route loading, route names might change as the FOSRestBundle used a different naming
convention. Mind the `.{_format}` suffix if you used the `fos_rest.routing_loader.include_format` option.

In case you have OpenAPI/Swagger annotations, you can also use [OpenAPI-Symfony-Routing](https://github.com/Tobion/OpenAPI-Symfony-Routing)
which removes the need to have routing information duplicated. It also allows to add the `.{_format}` suffix automatically as before.

If migration to explicit routes is not possible or feasible, consider using
[RestRoutingBundle](https://github.com/handcraftedinthealps/RestRoutingBundle) which extracted the auto-generation of routes
in a BC way.
* deprecated support for serializing exceptions, disable it by setting the `serialize_exceptions`
option to false:

Expand Down
30 changes: 28 additions & 2 deletions UPGRADING-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,34 @@ Upgrading From 2.x To 3.0
routing_loader: false
```
You need to configure your routes explicitly or consider using the
[RestRoutingBundle](https://github.com/handcraftedinthealps/RestRoutingBundle).
You need to configure your routes explicitly, e.g. using the Symfony Core annotations or the FOSRestBundle
shortcuts like `FOS\RestBundle\Controller\Annotations\Get`. You can use
`bin/console debug:router --show-controllers` to help with the migration and compare routes before and after it.
Change the routing loading:

Before:
```
Acme\Controller\TestController:
type: rest
resource: Acme\Controller\TestController
```

After:
```
Acme\Controller\TestController:
type: annotation
resource: Acme\Controller\TestController
```

When using the Symfony Core route loading, route names might change as the FOSRestBundle used a different naming
convention. Mind the `.{_format}` suffix if you used the `fos_rest.routing_loader.include_format` option.

In case you have OpenAPI/Swagger annotations, you can also use [OpenAPI-Symfony-Routing](https://github.com/Tobion/OpenAPI-Symfony-Routing)
which removes the need to have routing information duplicated. It also allows to add the `.{_format}` suffix automatically as before.

If migration to explicit routes is not possible or feasible, consider using
[RestRoutingBundle](https://github.com/handcraftedinthealps/RestRoutingBundle) which extracted the auto-generation of routes
in a BC way.

* Support for serializing exceptions has been removed. Setting the
`fos_rest.exception.serialize_exceptions` option to anything else than `false` leads to an exception.
Expand Down

0 comments on commit 6571903

Please sign in to comment.