Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Routing] Documented the option to exclude patterns#12821

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
OskarStark merged 1 commit intosymfony:4.4fromjaviereguiluz:fix_12590
Dec 17, 2019
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletionrouting.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1174,6 +1174,8 @@ the common configuration using options when importing the routes.
# An imported route with an empty URL will become "/blog/"
# Uncomment this option to make that URL "/blog" instead
# trailing_slash_on_root: false
# you can optionally exclude some files/subdirectories when loading annotations
# exclude: '../src/Controller/{DebugEmailController}.php'

.. code-block:: xml

Expand All@@ -1187,11 +1189,13 @@ the common configuration using options when importing the routes.
<!--
the 'prefix' value is added to the beginning of all imported route URLs
the 'name-prefix' value is added to the beginning of all imported route names
the 'exclude' option defines the files or subdirectories ignored when loading annotations
-->
<import resource="../src/Controller/"
type="annotation"
prefix="/blog"
name-prefix="blog_">
name-prefix="blog_"
exclude="../src/Controller/{DebugEmailController}.php">
<!-- these requirements are added to all imported routes -->
<requirement key="_locale">en|es|fr</requirement>
</import>
Expand All@@ -1211,6 +1215,8 @@ the common configuration using options when importing the routes.
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return function (RoutingConfigurator $routes) {
// use the optional fifth argument of import() to exclude some files
// or subdirectories when loading annotations
$routes->import('../src/Controller/', 'annotation')
// this is added to the beginning of all imported route URLs
->prefix('/blog')
Expand All@@ -1224,6 +1230,11 @@ the common configuration using options when importing the routes.
;
};

.. versionadded:: 4.4

The option to exclude some files or subdirectories when loading annotations
was introduced in Symfony 4.4.

In this example, the route of the ``index()`` action will be called ``blog_index``
and its URL will be ``/blog/``. The route of the ``show()`` action will be called
``blog_show`` and its URL will be ``/blog/{_locale}/posts/{slug}``. Both routes
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp