Permalink
Commits on Mar 19, 2018
  1. typo

    nicolas-grekas committed Mar 19, 2018
  2. feature #26143 [Routing] Implement i18n routing (frankdejonge, nicola…

    nicolas-grekas committed Mar 19, 2018
    …s-grekas)
    
    This PR was merged into the 4.1-dev branch.
    
    Discussion
    ----------
    
    [Routing]  Implement i18n routing
    
    | Q             | A
    | ------------- | ---
    | Branch?       | master
    | Bug fix?      |no
    | New feature?  | yes
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | N/A
    | License       | MIT
    
    This PR introduces support for I18N routing into core. This is a port from a bundle I've made recently, now merged into the default implementation. While it's ok to have this as a bundle, it was suggested by @nicolas-grekas to create a PR for this so it can be included into the core.
    
    ## New usages
    
    ### YAML
    
    ```yaml
    contact:
        controller: ContactController::formAction
        path:
            en: /send-us-an-email
            nl: /stuur-ons-een-email
    ```
    
    Will be effectively the same as declaring:
    
    ```yaml
    contact.en:
        controller: ContactController::formAction
        path: /send-us-an-email
        defaults:
            _locale: en
    
    contact.nl:
        controller: ContactController::formAction
        path: /stuur-ons-een-email
        defaults:
            _locale: nl
    ```
    
    ### Annotation usage:
    
    ```php
    <?php
    
    use Symfony\Component\Routing\Annotation\Route;
    
    class ContactController
    {
        /**
         * @Route({"en": "/send-us-an-email", "nl": "/stuur-ons-een-email"}, name="contact")
         */
        public function formAction()
        {
    
        }
    }
    
    /**
     * @Route("/contact")
     */
    class PrefixedContactController
    {
        /**
         * @Route({"en": "/send-us-an-email", "nl": "/stuur-ons-een-email"}, name="contact")
         */
        public function formAction()
        {
    
        }
    }
    ```
    
    ### Route generation
    
    ```php
    <?php
    /** @var UrlGeneratorInterface $urlGenerator */
    $urlWithCurrentLocale = $urlGenerator->generate('contact');
    $urlWithSpecifiedLocale = $urlGenerator->generate('contact', ['_locale' => 'nl']);
    ```
    
    Route generation is based on your request locale. When not available it falls back on a configured default. This way of route generation means you have a "route locale switcher" out of the box, but generate the current route with another locale for most cases.
    
    ## Advantages
    
    Having i18n routes defined like this has some advantages:
    
    * Less error prone.
    * No need to keep `requirements` or `defaults` in sync with other definitions.
    * No need to `{_locale}` in the path (bad for route matching performance).
    * Better developer experience.
    
    ### Next steps
    
    I've ported all the things the bundle supported, before moving on I'd like to discuss this first in order not to waste our collective time. This initial PR should give a clear enough picture to see what/how/why this is done.
    
    If and when accepted I/we can move forward to implement the XML loader and @nicolas-grekas mentioned there should be a `Configurator` implemented for this as well. He opted to help with this (for which I'm very thankful).
    
    - [x] Yaml Loader
    - [x] Annotation Loader
    - [x] XML Loader
    - [x] PHP Loader?
    - [ ] Documentation
    
    Commits
    -------
    
    4ae66dc [Routing] Handle "_canonical_route"
    e32c414 [Routing] Implement i18n routing
Commits on Mar 11, 2018
  1. bug #26041 Display the Welcome Page when there is no homepage defined…

    fabpot committed Mar 11, 2018
    … (javiereguiluz)
    
    This PR was squashed before being merged into the 3.4 branch (closes #26041).
    
    Discussion
    ----------
    
    Display the Welcome Page when there is no homepage defined
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 3.4
    | Bug fix?      | yes
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | symfony/symfony-docs#9178
    | License       | MIT
    | Doc PR        | -
    
    In 3.4 we added a trick to display the Welcome Page when the user browses `/` and there are no routes defined. However, when using the `website-skeleton` (which is what most newcomers use ... and they are the ones that mostly need the "Welcome Page") the premise about *"no routes are defined"* is never true and the Welcome Page is never shown (see symfony/symfony-docs#9178 for one of the multiple error reports we've received).
    
    So, I propose to make this change to always define the "Welcome Page" as the fallback:
    
    * If no routes are defined for `/`, the Welcome Page is displayed.
    * If there is a route defined for `/`, this code will never be executed because it's the last condition of the routing matcher.
    
    Commits
    -------
    
    5b0d9340d7 Display the Welcome Page when there is no homepage defined
Commits on Feb 28, 2018
  1. Merge branch '4.0'

    fabpot committed Feb 28, 2018
    * 4.0:
      [Form][WCAG] Add hidden labels on date and time fields
      Pass on previous exception in FatalThrowableError
      [Routing] remove dead code
      [Routing] fix typo
      [Form][WCAG] Fixed HTML errors
      fix merge
      [FrameworkBundle] [Console] add a warning when command is not found
      [WebProfilerBundle] limit ajax request to 100 and remove the last one
  2. Merge branch '3.4' into 4.0

    fabpot committed Feb 28, 2018
    * 3.4:
      [Form][WCAG] Add hidden labels on date and time fields
      Pass on previous exception in FatalThrowableError
      [Routing] remove dead code
      [Routing] fix typo
      [Form][WCAG] Fixed HTML errors
      fix merge
      [FrameworkBundle] [Console] add a warning when command is not found
      [WebProfilerBundle] limit ajax request to 100 and remove the last one
  3. Merge branch '2.8' into 3.4

    fabpot committed Feb 28, 2018
    * 2.8:
      Pass on previous exception in FatalThrowableError
      [Routing] remove dead code
      [Routing] fix typo
  4. Merge branch '2.7' into 2.8

    fabpot committed Feb 28, 2018
    * 2.7:
      Pass on previous exception in FatalThrowableError
      [Routing] remove dead code
      [Routing] fix typo
  5. [Routing] fix typo

    nicolas-grekas committed Feb 28, 2018
Commits on Feb 26, 2018
  1. Merge branch '4.0'

    nicolas-grekas committed Feb 26, 2018
    * 4.0:
      fix merge
  2. fix merge

    nicolas-grekas committed Feb 26, 2018
  3. Merge branch '4.0'

    nicolas-grekas committed Feb 26, 2018
    * 4.0:
      fix merge
  4. Merge branch '3.4' into 4.0

    nicolas-grekas committed Feb 26, 2018
    * 3.4:
      fix merge
  5. fix merge

    nicolas-grekas committed Feb 26, 2018
  6. Merge branch '4.0'

    nicolas-grekas committed Feb 26, 2018
    * 4.0:
      Fix typos
      [Routing] remove useless failing mocks
      [appveyor] Workaround GitHub disabling of low versions of TLS
      Use long array syntax
      [Routing] Fix GC control of PHP-DSL
      [Routing] Don't throw 405 when scheme requirement doesn't match
      [Routing] Revert throwing 405 on missed slash/scheme redirections
      [WebProfilerBundle] fix test after ajax path updated
      Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
      Update excluded_ajax_paths for sf4
      Add missing use for RoleInterface
      Add missing use of Role
      [Routing] fix CS
      add container.autowiring.strict_mode to 3.4 docs
      Set controller without __invoke method from invokable class
      [VarDumper] Fixed PHPDoc
  7. Merge branch '3.4' into 4.0

    nicolas-grekas committed Feb 26, 2018
    * 3.4:
      Fix typos
  8. Fix typos

    nicolas-grekas committed Feb 26, 2018
  9. Merge branch '3.4' into 4.0

    nicolas-grekas committed Feb 26, 2018
    * 3.4:
      [Routing] remove useless failing mocks
      [appveyor] Workaround GitHub disabling of low versions of TLS
      Use long array syntax
      [Routing] Fix GC control of PHP-DSL
      [Routing] Don't throw 405 when scheme requirement doesn't match
      [Routing] Revert throwing 405 on missed slash/scheme redirections
      [WebProfilerBundle] fix test after ajax path updated
      Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
      Update excluded_ajax_paths for sf4
      Add missing use for RoleInterface
      [Routing] fix CS
      add container.autowiring.strict_mode to 3.4 docs
      Set controller without __invoke method from invokable class
      [VarDumper] Fixed PHPDoc
  10. bug #26318 [Routing] Fix GC control of PHP-DSL (nicolas-grekas)

    nicolas-grekas committed Feb 26, 2018
    This PR was merged into the 3.4 branch.
    
    Discussion
    ----------
    
    [Routing] Fix GC control of PHP-DSL
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 3.4
    | Bug fix?      | yes
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | -
    | License       | MIT
    | Doc PR        | -
    
    Adding fluently in a collection is broken currently.
    
    Commits
    -------
    
    239f2e2 [Routing] Fix GC control of PHP-DSL
  11. Merge branch '2.8' into 3.4

    nicolas-grekas committed Feb 26, 2018
    * 2.8:
      [Routing] remove useless failing mocks
  12. Merge branch '2.7' into 2.8

    nicolas-grekas committed Feb 26, 2018
    * 2.7:
      [Routing] remove useless failing mocks
  13. Merge branch '2.8' into 3.4

    nicolas-grekas committed Feb 26, 2018
    * 2.8:
      [appveyor] Workaround GitHub disabling of low versions of TLS
      [Routing] Don't throw 405 when scheme requirement doesn't match
      [Routing] Revert throwing 405 on missed slash/scheme redirections
      Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
      [Routing] fix CS
  14. Merge branch '2.7' into 2.8

    nicolas-grekas committed Feb 26, 2018
    * 2.7:
      [appveyor] Workaround GitHub disabling of low versions of TLS
      [Routing] Don't throw 405 when scheme requirement doesn't match
      [Routing] Revert throwing 405 on missed slash/scheme redirections
      Fix ArrayInput::toString() for InputArgument::IS_ARRAY args
      [Routing] fix CS
  15. bug #26312 [Routing] Don't throw 405 when scheme requirement doesn't …

    nicolas-grekas committed Feb 26, 2018
    …match (nicolas-grekas)
    
    This PR was merged into the 2.7 branch.
    
    Discussion
    ----------
    
    [Routing] Don't throw 405 when scheme requirement doesn't match
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 2.7
    | Bug fix?      | yes
    | New feature?  | no
    | BC breaks?    | no
    | Deprecations? | no
    | Tests pass?   | yes
    | Fixed tickets | #22739
    | License       | MIT
    | Doc PR        | -
    
    Commits
    -------
    
    9d70ef0 [Routing] Don't throw 405 when scheme requirement doesn't match
Commits on Feb 25, 2018