Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose domains #346

Closed
tugrul opened this issue Jan 27, 2019 · 1 comment
Closed

expose domains #346

tugrul opened this issue Jan 27, 2019 · 1 comment

Comments

@tugrul
Copy link
Contributor

tugrul commented Jan 27, 2019

We can expose routes for only one domain in actual functionality.

/**
 * @Route("/a-page",
 *     options = { "expose" = true },
 *     name = "my_route_to_expose_with_defaults",
 * )
 */

Able to expose routes to different domains like following.

/**
 * @Route("/a-page",
 *     options = { "expose" = "blog" },
 *     name = "my_route_to_expose_blog",
 * )
 */

/**
 * @Route("/a-secret-page",
 *     options = { "expose" = "admin" },
 *     name = "my_route_to_expose_admin",
 * )
 */

Then we can expose routes by different contexts like following.

<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData", "domain": "blog"}) }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData", "domain": "admin"}) }}"></script>

also

$ php bin/console fos:js-routing:dump --domain=blog
<script src="/js/fos_js_routes_blog.js"></script>
$ php bin/console fos:js-routing:dump --domain=admin
<script src="/js/fos_js_routes_admin.js"></script>

{ "expose" = true } able to mean {"expose" = "default"} or {"expose" = "main"} to backward compatibility

Also merge all of domains' routes into single dump if we don't provide domain name like following.

$ php bin/console fos:js-routing:dump
<script src="/js/fos_js_routes.js"></script>

Also we can combine domain names

$ php bin/console fos:js-routing:dump --domain=admin,blog
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData", "domain": ["blog", admin]}) }}"></script>
@tugrul tugrul mentioned this issue Jan 28, 2019
@tobias-93
Copy link
Collaborator

Closed via #347

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

No branches or pull requests

2 participants