Skip to content

Migrate rest routings to default symfony routing files #7434

@alexander-schranz

Description

@alexander-schranz

Problem description

We want to remove the https://github.com/handcraftedinthealps/RestRoutingBundle as preperation for removing FOSRest.

The first step which we can already do on 2.6 is redefine all our routes in a new routing file yaml instead of the old yml and document that project should switch already to the new routing files.

https://github.com/sulu/skeleton/blob/2.6/config/routes/sulu_admin.yaml

Proposed solution

Skeleton: config/routes/sulu_admin.yaml:

sulu_tag_api:
-    resource: "@SuluTagBundle/Resources/config/routing_api.yml"
-    type: rest
+    resource: "@SuluTagBundle/Resources/config/routing_api.yaml"
     prefix: /admin/api

Sulu: src/Sulu/Bundle/TagBundle/Resources/config/routing_api.yml (keep as it is on 2.6) (remove on 3.0):

sulu_tag.tags:
    type: rest
    name_prefix: sulu_tag.
    resource: sulu_tag.tag_controller

sulu_tag.post_tag_merge:
    path: /tags/merge.{_format}
    methods: POST
    defaults:
        _controller: sulu_tag.tag_controller::postMergeAction
        _format: json

Sulu: src/Sulu/Bundle/TagBundle/Resources/config/routing_api.yaml (add to 2.6):

sulu_tag.get_tag:
    path: /tags/{id}.{_format}
    controller: sulu_tag.tag_controller::getAction
    methods: GET
    format: json
    requirements:
       _format: json|csv

sulu_tag.get_tags:
    path: /tags.{_format}
    controller: sulu_tag.tag_controller::cgetAction
    methods: GET
    format: json
    requirements:
        _format: json|csv

sulu_tag.post_tag:
    path: /tags.{_format}
    controller: sulu_tag.tag_controller::postAction
    methods: POST
    format: json
    requirements:
        _format: json|csv

sulu_tag.put_tag:
    path: /tags/{id}.{_format}
    controller: sulu_tag.tag_controller::putAction
    methods: PUT
    format: json
    requirements:
        _format: json|csv

sulu_tag.delete_tag:
    path: /tags/{id}.{_format}
    controller: sulu_tag.tag_controller::deleteAction
    methods: DELETE
    format: json
    requirements:
        _format: json|csv

sulu_tag.patch_tags:
    path: /tags.{_format}
    controller: sulu_tag.tag_controller::cpatchAction
    methods: PATCH
    format: json
    requirements:
        _format: json|csv

sulu_tag.post_tag_merge:
    path: /tags/merge.{_format}
    controller: sulu_tag.tag_controller::postMergeAction
    methods: POST
    format: json
    requirements:
        _format: json|csv

When changing from yml to yaml the output of the both routing should be nearly similar when running bin/console debug:router --format json.

TODO

None rest routes to yaml:

  • AdminBundle
  • LocationBundle
  • MediaBundle
  • WebsiteBundle

None core bundles:

  • sulu/SuluFormBundle
  • sulu/SuluCommentBundle
  • sulu/SuluRedirectBundle
  • sulu/SuluContentBundle
  • sulu/SuluArticleBundle
  • sulu/SuluHeadlessBundle
  • sulu/SuluSyliusConsumerBundle
  • sulu/SuluSyliusProducerPlugin
  • sulu/SuluAutomationBundle
  • sulu/SuluCommunityBundle

Todo:

  • Check SecuredControllerInterface functionality without Rest Routing

Metadata

Metadata

Assignees

Labels

DXAffecting the end developer

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions