Skip to content

[New routing] Admin administrators crud#18231

Merged
NoResponseMate merged 1 commit intoSylius:new-routingfrom
loic425:admin-administrators-crud
Jul 18, 2025
Merged

[New routing] Admin administrators crud#18231
NoResponseMate merged 1 commit intoSylius:new-routingfrom
loic425:admin-administrators-crud

Conversation

@loic425
Copy link
Copy Markdown
Member

@loic425 loic425 commented Jul 17, 2025

Q A
Branch? new-routing
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets partially #18212
License MIT

Summary by CodeRabbit

  • New Features

    • Introduced fine-grained control over routing backward compatibility (BC) layers, allowing global and per-route enablement or disablement.
    • Added new resource metadata configurations for admin user and product management in the admin interface, supporting CRUD and bulk operations.
    • Added new routing configuration for resource-based routes.
  • Bug Fixes

    • Improved route matching logic for page resolution to support route names with or without a leading underscore.
  • Style

    • Updated test cases to standardize URL paths by removing trailing slashes.
  • Chores

    • Updated dependency requirements to allow newer development versions of resource and resource-bundle packages across multiple components and bundles.
  • Tests

    • Added and enhanced tests for routing BC layer configuration and request context behavior.
    • Adjusted test expectations for route name matching and updated test paths for consistency.

@loic425 loic425 requested review from a team as code owners July 17, 2025 09:19
@loic425 loic425 changed the base branch from 2.1 to new-routing July 17, 2025 09:19
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 17, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a backward compatibility (BC) routing layer with per-route enablement in the Sylius CoreBundle, adds new resource metadata configurations for admin user and product entities, and updates routing and service definitions to support these changes. Additionally, dependency constraints for "sylius/resource" and "sylius/resource-bundle" are bumped to "^1.14@dev" across multiple components and bundles.

Changes

File(s) / Group Change Summary
composer.json, src/Sylius/Component//composer.json, src/Sylius/Bundle//composer.json Updated "sylius/resource" and/or "sylius/resource-bundle" version constraints from "^1.12" to "^1.14@dev".
config/packages/_sylius.yaml Added BC routing layer config and resource mapping import; disabled BC layer for specific admin routes.
config/routes/sylius_resource.yaml Introduced new service-based route using resource loader.
src/Sylius/Behat/Service/Resolver/CurrentPageResolver.php Expanded route matching logic to also match routes with a leading underscore.
src/Sylius/Behat/tests/Service/Resolver/CurrentPageResolverTest.php Adjusted mock expectations for route name calls in a test.
src/Sylius/Bundle/AdminBundle/Resources/config/app/sylius/resources/admin_user.php Added admin user resource metadata configuration.
src/Sylius/Bundle/AdminBundle/Resources/config/app/sylius/resources/product.php Added product resource metadata configuration.
src/Sylius/Bundle/AdminBundle/Resources/config/routing/admin_user.yml Added BC layer condition to admin user route.
src/Sylius/Bundle/AdminBundle/Resources/config/routing/product.yml Added BC layer condition to product route.
src/Sylius/Bundle/CoreBundle/DependencyInjection/Configuration.php Added routing.bc_layer config section with global and per-route enablement.
src/Sylius/Bundle/CoreBundle/DependencyInjection/SyliusCoreExtension.php Set container parameter for BC layer config.
src/Sylius/Bundle/CoreBundle/Resources/config/services.xml Added service decorating router.request_context to support BC layer.
src/Sylius/Bundle/CoreBundle/Routing/RequestContext.php Introduced final class for BC-aware request context with enablement-checking method.
src/Sylius/Bundle/CoreBundle/tests/DependencyInjection/ConfigurationTest.php Added tests for BC routing layer configuration scenarios.
src/Sylius/Bundle/CoreBundle/tests/Routing/RequestContextTest.php Added tests for BC layer enablement/disablement logic in request context.
tests/Twig/RedirectPathExtensionTest.php Updated test paths to remove trailing slashes in assertions and input.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SymfonyRouter
    participant SyliusRequestContext
    participant Config

    User->>SymfonyRouter: Requests admin route (e.g., admin_product)
    SymfonyRouter->>SyliusRequestContext: Check if BC layer is enabled for route
    SyliusRequestContext->>Config: Lookup global and per-route BC layer settings
    Config-->>SyliusRequestContext: Return enabled/disabled flag
    SyliusRequestContext-->>SymfonyRouter: Return BC layer status
    SymfonyRouter-->>User: Route accordingly (BC or new route)
Loading

Suggested labels

Admin, Maintenance, API

Suggested reviewers

  • GSadee

Poem

A hop and a skip, a BC layer appears,
Routing now smarter, for future-proof years.
Admins and products, with metadata anew,
Composer constraints rising, to 1.14—woohoo!
Tests pruned of slashes, all neat and precise,
This rabbit approves—these changes are nice! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jul 17, 2025

❌ Preview Environment deleted from Bunnyshell

Available commands:

  • 🚀 /bns:deploy to redeploy the environment

bc_layer:
enabled: true
routes:
admin_administrators:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
admin_administrators:
admin_admin_user:

WDYT? It looks a bit weird, but it's the name used in configs and is in line with the routes themselves, sylius_admin_admin_user_create etc.

Copy link
Copy Markdown
Member Author

@loic425 loic425 Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was mitigated. The Behat suite is named ui_managing_administrators and the Behat tag too.

@loic425 loic425 changed the title Admin administrators crud [New routing] Admin administrators crud Jul 18, 2025
@loic425 loic425 force-pushed the admin-administrators-crud branch from 8f5be62 to a7f54b5 Compare July 18, 2025 08:34
@loic425 loic425 force-pushed the admin-administrators-crud branch from a7f54b5 to 71f5287 Compare July 18, 2025 09:00
@NoResponseMate NoResponseMate merged commit ae63668 into Sylius:new-routing Jul 18, 2025
29 of 31 checks passed
@loic425 loic425 deleted the admin-administrators-crud branch July 18, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants