Skip to content

Commit f39d6fa

Browse files
committed
Replacing rest routes with symfony routes
1 parent 17e2867 commit f39d6fa

File tree

6 files changed

+90
-21
lines changed

6 files changed

+90
-21
lines changed

Controller/BlacklistItemController.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@
1212
namespace Sulu\Bundle\CommunityBundle\Controller;
1313

1414
use Doctrine\ORM\EntityManagerInterface;
15-
use FOS\RestBundle\Controller\Annotations\NamePrefix;
16-
use FOS\RestBundle\Controller\Annotations\RouteResource;
17-
use FOS\RestBundle\Routing\ClassResourceInterface;
1815
use FOS\RestBundle\View\ViewHandlerInterface;
16+
use Sulu\Component\Rest\AbstractRestController;
1917
use Sulu\Bundle\CommunityBundle\Entity\BlacklistItem;
2018
use Sulu\Bundle\CommunityBundle\Manager\BlacklistItemManagerInterface;
21-
use Sulu\Component\Rest\AbstractRestController;
2219
use Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilderFactoryInterface;
2320
use Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor;
2421
use Sulu\Component\Rest\ListBuilder\FieldDescriptorInterface;
@@ -32,12 +29,8 @@
3229

3330
/**
3431
* Provides admin-api for blacklist-items.
35-
*
36-
* @NamePrefix("sulu_community.")
37-
*
38-
* @RouteResource("blacklist-item")
3932
*/
40-
class BlacklistItemController extends AbstractRestController implements ClassResourceInterface
33+
class BlacklistItemController extends AbstractRestController
4134
{
4235
use RequestParametersTrait;
4336

Resources/config/routing_api.yaml

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,55 @@
1-
sulu_community.blacklist_item:
2-
type: rest
3-
resource: sulu_community.controller.blacklist_item
1+
sulu_community.fields_blacklist-item:
2+
path: '/blacklist-items/fields.{_format}'
3+
methods: GET
4+
controller: 'sulu_community.controller.blacklist_item::fieldsAction'
5+
format: json
6+
defaults: { _format: json }
7+
requirements: { _format: json|csv }
8+
9+
sulu_community.get_blacklist-items:
10+
path: '/blacklist-items.{_format}'
11+
methods: GET
12+
controller: 'sulu_community.controller.blacklist_item::cgetAction'
13+
format: json
14+
defaults: { _format: json }
15+
requirements: { _format: json|csv }
16+
17+
sulu_community.get_blacklist-item:
18+
path: '/blacklist-items/{id}.{_format}'
19+
methods: GET
20+
controller: 'sulu_community.controller.blacklist_item::getAction'
21+
format: json
22+
defaults: { _format: json }
23+
requirements: { _format: json|csv }
24+
25+
sulu_community.post_blacklist-item:
26+
path: '/blacklist-items.{_format}'
27+
methods: POST
28+
controller: 'sulu_community.controller.blacklist_item::postAction'
29+
format: json
30+
defaults: { _format: json }
31+
requirements: { _format: json|csv }
32+
33+
sulu_community.delete_blacklist-item:
34+
path: '/blacklist-items/{id}.{_format}'
35+
methods: DELETE
36+
controller: 'sulu_community.controller.blacklist_item::deleteAction'
37+
format: json
38+
defaults: { _format: json }
39+
requirements: { _format: json|csv }
40+
41+
sulu_community.delete_blacklist-items:
42+
path: '/blacklist-items.{_format}'
43+
methods: DELETE
44+
controller: 'sulu_community.controller.blacklist_item::cdeleteAction'
45+
format: json
46+
defaults: { _format: json }
47+
requirements: { _format: json|csv }
48+
49+
sulu_community.put_blacklist-item:
50+
path: '/blacklist-items/{id}.{_format}'
51+
methods: PUT
52+
controller: 'sulu_community.controller.blacklist_item::putAction'
53+
format: json
54+
defaults: { _format: json }
55+
requirements: { _format: json|csv }

Resources/doc/1-installation.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Register the admin routes:
4040
# config/routes/sulu_community_admin.yaml
4141

4242
sulu_community_api:
43-
type: rest
4443
resource: "@SuluCommunityBundle/Resources/config/routing_api.yaml"
4544
prefix: /admin/api
4645
```
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
sulu_community_api:
2-
type: rest
32
prefix: /admin/api
43
resource: "@SuluCommunityBundle/Resources/config/routing_api.yaml"

UPGRADE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
## 2.0.0 (unreleased)
44

5+
### FOSRestRouting Bundle removed
6+
7+
As announced in Sulu [2.6.10](https://github.com/sulu/sulu/blob/2.6/UPGRADE-2.x.md)
8+
the `type: rest` / [FOSRestRouting](https://github.com/handcraftedinthealps/RestRoutingBundle) was removed.
9+
10+
The following change is needed in your application:
11+
12+
```diff
13+
# config/routes/sulu_community_admin.yaml
14+
15+
sulu_community_api:
16+
- type: rest
17+
resource: "@SuluCommunityBundle/Resources/config/routing_api.yaml"
18+
prefix: /admin/api
19+
```
20+
521
### ListRepresentation relation name changed
622

723
The name of the relation inside of the `_embedded` field has been changed from `items` to `blacklist_items`.

phpstan-baseline.neon

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,42 @@ parameters:
3636
path: Controller/AbstractController.php
3737

3838
-
39-
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Manager\\\\CommunityManagerInterface\\:\\:completion\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, mixed given\\.$#"
39+
message: "#^Parameter \\#1 \\$type of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createForm\\(\\) expects class\\-string\\<Symfony\\\\Component\\\\Form\\\\FormTypeInterface\\<Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User\\>\\>, string given\\.$#"
4040
count: 1
4141
path: Controller/CompletionController.php
4242

4343
-
44-
message: "#^Parameter \\#2 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\CompletionController\\:\\:saveMediaFields\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, mixed given\\.$#"
44+
message: "#^Parameter \\#1 \\$emailUsername of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Manager\\\\CommunityManagerInterface\\:\\:passwordForget\\(\\) expects string, mixed given\\.$#"
4545
count: 1
46-
path: Controller/CompletionController.php
46+
path: Controller/PasswordController.php
4747

4848
-
49-
message: "#^Parameter \\#1 \\$emailUsername of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Manager\\\\CommunityManagerInterface\\:\\:passwordForget\\(\\) expects string, mixed given\\.$#"
49+
message: "#^Parameter \\#1 \\$type of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createForm\\(\\) expects class\\-string\\<Symfony\\\\Component\\\\Form\\\\FormTypeInterface\\<Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User\\>\\>, string given\\.$#"
5050
count: 1
5151
path: Controller/PasswordController.php
5252

5353
-
54-
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\AbstractController\\:\\:setUserPasswordAndSalt\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, mixed given\\.$#"
54+
message: "#^Parameter \\#1 \\$type of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createForm\\(\\) expects class\\-string\\<Symfony\\\\Component\\\\Form\\\\FormTypeInterface\\<array\\{\\}\\>\\>, string given\\.$#"
5555
count: 1
5656
path: Controller/PasswordController.php
5757

5858
-
59-
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\AbstractController\\:\\:setUserPasswordAndSalt\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, mixed given\\.$#"
59+
message: "#^Parameter \\#1 \\$type of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createForm\\(\\) expects class\\-string\\<Symfony\\\\Component\\\\Form\\\\FormTypeInterface\\<Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User\\|null\\>\\>, string given\\.$#"
60+
count: 1
61+
path: Controller/ProfileController.php
62+
63+
-
64+
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\AbstractController\\:\\:setUserPasswordAndSalt\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User\\|null given\\.$#"
6065
count: 1
6166
path: Controller/ProfileController.php
6267

6368
-
64-
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\AbstractController\\:\\:setUserPasswordAndSalt\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, mixed given\\.$#"
69+
message: "#^Parameter \\#1 \\$type of method Symfony\\\\Bundle\\\\FrameworkBundle\\\\Controller\\\\AbstractController\\:\\:createForm\\(\\) expects class\\-string\\<Symfony\\\\Component\\\\Form\\\\FormTypeInterface\\<null\\>\\>, string given\\.$#"
70+
count: 1
71+
path: Controller/RegistrationController.php
72+
73+
-
74+
message: "#^Parameter \\#1 \\$user of method Sulu\\\\Bundle\\\\CommunityBundle\\\\Controller\\\\AbstractController\\:\\:setUserPasswordAndSalt\\(\\) expects Sulu\\\\Bundle\\\\SecurityBundle\\\\Entity\\\\User, null given\\.$#"
6575
count: 1
6676
path: Controller/RegistrationController.php
6777

0 commit comments

Comments
 (0)