60 Commits

Author SHA1 Message Date
Alexandre Daubois
0c8ac7da2b Remove unused code and unnecessary else branches 2024-08-02 08:50:04 +02:00
Alexander M. Turek
4875a8487f Prefix all sprintf() calls 2024-06-20 17:52:34 +02:00
Alexandre Daubois
b2166d2abc [DependencyInjection] Remove deprecations across the component 2023-06-30 17:36:04 +02:00
Alexandre Daubois
9b879dc3ad [DependencyInjection] Deprecate ContainerAwareInterface, ContainerAwareTrait and ContainerAwareLoader 2023-06-20 17:03:27 +02:00
Grégoire Pineau
fb7ade8fab [CS] Remove @inheritdoc PHPDoc 2022-08-25 17:27:04 +02:00
Nicolas Grekas
6e1849b890 [FrameworkBundle] add union types 2021-06-30 18:19:31 +02:00
dFayet
73d51f2a88 Replace @return annotation by return type in final classes 2019-06-23 00:57:33 +02:00
Nicolas Grekas
f281625e21 Remove deprecated code paths that trigger a runtime notice 2019-06-09 16:44:48 +02:00
Amrouche Hamza
8b98b87a26 [FrameworkBundle] remove deprecater controller a:b:c notation 2019-06-04 12:31:50 +02:00
Robin Chalas
3373f999fc [FrameworkBundle] Add missing BC layer for deprecated ControllerNameParser injections 2019-06-03 15:37:01 +02:00
Nicolas Grekas
e7c305cc00 Merge branch '4.1'
* 4.1:
  Alpha-ordering for "use" statements
2018-07-26 11:13:01 +02:00
Nicolas Grekas
92f6742b16 Merge branch '4.0' into 4.1
* 4.0:
  Alpha-ordering for "use" statements
2018-07-26 11:10:45 +02:00
Nicolas Grekas
f262579e4a Merge branch '3.4' into 4.0
* 3.4:
  Alpha-ordering for "use" statements
2018-07-26 11:08:35 +02:00
Nicolas Grekas
a281fdb702 Merge branch '2.8' into 3.4
* 2.8:
  Alpha-ordering for "use" statements
2018-07-26 11:06:28 +02:00
Nicolas Grekas
f607411732 Alpha-ordering for "use" statements 2018-07-26 11:03:18 +02:00
Nicolas Grekas
f0d00646a5 Merge branch '4.1'
* 4.1:
  Fix Clidumper tests
  Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
  Apply fixers
  Disable the native_constant_invocation fixer until it can be scoped
  Update the list of excluded files for the CS fixer
2018-07-26 10:59:12 +02:00
Nicolas Grekas
b0ec67980c Merge branch '3.4' into 4.0
* 3.4:
  Fix Clidumper tests
  Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
  Apply fixers
  Disable the native_constant_invocation fixer until it can be scoped
  Update the list of excluded files for the CS fixer
2018-07-26 10:51:09 +02:00
Nicolas Grekas
e26429262d Merge branch '2.8' into 3.4
* 2.8:
  Fix Clidumper tests
  Enable the fixer enforcing fully-qualified calls for compiler-optimized functions
  Apply fixers
  Disable the native_constant_invocation fixer until it can be scoped
  Update the list of excluded files for the CS fixer
2018-07-26 10:45:46 +02:00
Nicolas Grekas
517e644dc6 [FrameworkBundle] Deprecate auto-injection of the container in AbstractController instances 2018-06-04 13:21:25 +02:00
Tobias Schultze
bbd0ca744a Deprecate bundle:controller:action and service:method notation 2018-02-21 06:14:04 +01:00
Nicolas Grekas
f32f066a89 Merge branch '3.4'
* 3.4:
  [DI] minor docblock fixes
2017-10-24 16:16:56 +02:00
Nicolas Grekas
91ed9343b4 Merge branch '3.3' into 3.4
* 3.3:
  [DI] minor docblock fixes
2017-10-24 16:12:06 +02:00
Nicolas Grekas
6df0bf1ea8 Merge branch '2.8' into 3.3
* 2.8:
  [DI] minor docblock fixes
2017-10-24 16:05:06 +02:00
Nicolas Grekas
2bb9fecef1 [DI] minor docblock fixes 2017-10-24 13:40:19 +02:00
Nicolas Grekas
7d0e148ce0 [Bridge\Doctrine][FrameworkBundle] Remove legacy uses of ContainerAwareInterface 2017-10-05 17:34:34 +02:00
Nicolas Grekas
09ae506b40 [Bridge\Doctrine][FrameworkBundle] Deprecate some remaining uses of ContainerAwareTrait 2017-10-05 16:01:01 +02:00
Nicolas Grekas
1c9ad51cf1 Merge branch '2.8' into 3.3
* 2.8: (22 commits)
  Tests and fix for issue in array model data in EntityType field with multiple=true
  [Form] Fixed PercentToLocalizedStringTransformer to accept both comma and dot as decimal separator, if possible
  removed useless PHPDoc
  [Form] Fix FormInterface::submit() annotation
  PdoSessionHandler: fix advisory lock for pgsql when session.sid_bits_per_character > 4
  HttpCache does not consider ESI resources in HEAD requests
  Fix translation for "This field was not expected"
  [Routing] Enhance Route(Collection) docblocks
  Added improvement for accuracy in MoneyToLocalizedStringTransformer.
  Removed unused private property
  Use correct verb form in the pull request template
  Use PHP_MAXPATHLEN in Filesystem.
  Added null as explicit return type (?TokenInterface)
  [FrameworkBundle] Fix Routing\DelegatingLoader
  Render all line breaks according to the exception message
  [Form] Fix phpdoc
  [DI] remove confusing code
  [Form] Fixed GroupSequence with "constraints" option
  [Validator] Clarify UUID validator behavior
  [Filesystem] Fixed makePathRelative
  ...
2017-10-02 08:42:24 +02:00
Oskar Stark
e8cd5edd54 removed useless PHPDoc 2017-09-30 07:00:23 -07:00
Christian Flothmann
9a64c5da40 call setContainer() for autowired controllers 2017-07-03 16:15:38 +02:00
Nicolas Grekas
8a3d8101bd [FrameworkBundle] Introduce AbstractController, replacing ControllerTrait 2017-03-25 18:18:01 +01:00
Maxime Steinhausser
3b80128248 [HttpKernel] Add a ContainerControllerResolver (psr-11) 2017-02-28 21:33:09 +01:00
Kévin Dunglas
950be7a217 [FrameworkBundle] Return the invokable service if its name is the class name 2016-03-31 22:45:44 +02:00
Kévin Dunglas
c8072ae1e3 [FrameworkBundle] Return the invokable service if its name is the class name 2016-03-25 18:28:04 +01:00
Christophe Coevoet
2db926e810 Fix the injection of the container in invokable controllers 2015-09-09 14:19:27 +02:00
sergey
f1d3b7e979 [HttpKernel] Added use of provided by #12022 method to instantiate controller class in bundle's controller resolver 2015-02-02 15:24:27 +02:00
Fabien Potencier
19b2772078 Merge branch '2.5' into 2.6
* 2.5:
  Configure firewall's kernel exception listener with configured entry point or a default entry point
  PSR-2 fixes
  [DependencyInjection] make paths relative to __DIR__ in the generated container
  Fixed the syntax of a composer.json file
  Fixed the symfony/config version constraint
  Tweaked the password-compat version constraint
  Docblock fixes
  Remove dialog usage
  define constant only if it wasn't defined before
  Fix incorrect spanish translation
  Fixed typos

Conflicts:
	src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
	src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
	src/Symfony/Component/OptionsResolver/Options.php
	src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php
	src/Symfony/Component/Process/ProcessPipes.php
	src/Symfony/Component/Security/Http/Tests/Firewall/RememberMeListenerTest.php
	src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php
	src/Symfony/Component/Validator/ConstraintViolation.php
	src/Symfony/Component/Yaml/Inline.php
	src/Symfony/Component/Yaml/Parser.php
2014-12-02 21:19:20 +01:00
Graham Campbell
f91a8261b2 Docblock fixes 2014-11-30 13:33:44 +00:00
Fabien Potencier
71f47b1597 fixed CS 2014-06-26 09:13:51 +02:00
Kevin Bond
119c2e8383 [FrameworkBundle] Simplify "invokable" controllers as services 2014-06-26 09:12:55 +02:00
Fabien Potencier
939b8abaf9 removed unneeded use statements 2014-01-01 08:52:14 +01:00
Jordi Boggiano
8c975025d2 Remove use of deprecated HttpKernel LoggerInterface 2013-01-09 10:52:29 +01:00
Drak
7d8e03c3a0 Typo spelling mistake 2012-04-24 22:43:51 +05:45
Victor Berchet
8bd0a528ee cleanup 2012-02-06 20:42:20 +01:00
Victor Berchet
533208aeeb [FrameworkBundle] fix phpDoc of ControllerResolver::createController() 2012-02-06 19:09:38 +01:00
Andrej Hudec
db21b42064 change explode's limit parameter based on known variable content 2011-12-11 21:58:35 +01:00
Andrej Hudec
eb72d9c703 minor optimalisations for explode 2011-12-11 21:58:30 +01:00
Fabien Potencier
2b33054a66 replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Fabien Potencier
fbfaad5ca5 moved ControllerResolver methods to HttpKernel (makes more sense) 2011-01-23 10:23:33 +01:00
Fabien Potencier
923e77935c refactored bundle management
Before I explain the changes, let's talk about the current state.

Before this patch, the registerBundleDirs() method returned an ordered (for
resource overloading) list of namespace prefixes and the path to their
location. Here are some problems with this approach:

 * The paths set by this method and the paths configured for the autoloader
   can be disconnected (leading to unexpected behaviors);

 * A bundle outside these paths worked, but unexpected behavior can occur;

 * Choosing a bundle namespace was limited to the registered namespace
   prefixes, and their number should stay low enough (for performance reasons)
   -- moreover the current Bundle\ and Application\ top namespaces does not
   respect the standard rules for namespaces (first segment should be the
   vendor name);

 * Developers must understand the concept of "namespace prefixes" to
   understand the overloading mechanism, which is one more thing to learn,
   which is Symfony specific;

 * Each time you want to get a resource that can be overloaded (a template for
   instance), Symfony would have tried all namespace prefixes one after the
   other until if finds a matching file. But that can be computed in advance
   to reduce the overhead.

Another topic which was not really well addressed is how you can reference a
file/resource from a bundle (and take into account the possibility of
overloading). For instance, in the routing, you can import a file from a
bundle like this:

  <import resource="FrameworkBundle/Resources/config/internal.xml" />

Again, this works only because we have a limited number of possible namespace
prefixes.

This patch addresses these problems and some more.

First, the registerBundleDirs() method has been removed. It means that you are
now free to use any namespace for your bundles. No need to have specific
prefixes anymore. You are also free to store them anywhere, in as many
directories as you want. You just need to be sure that they are autoloaded
correctly.

The bundle "name" is now always the short name of the bundle class (like
FrameworkBundle or SensioCasBundle). As the best practice is to prefix the
bundle name with the vendor name, it's up to the vendor to ensure that each
bundle name is unique. I insist that a bundle name must be unique. This was
the opposite before as two bundles with the same name was how Symfony2 found
inheritance.

A new getParent() method has been added to BundleInterface. It returns the
bundle name that the bundle overrides (this is optional of course). That way,
there is no ordering problem anymore as the inheritance tree is explicitely
defined by the bundle themselves.

So, with this system, we can easily have an inheritance tree like the
following:

FooBundle < MyFooBundle < MyCustomFooBundle

MyCustomFooBundle returns MyFooBundle for the getParent() method, and
MyFooBundle returns FooBundle.

If two bundles override the same bundle, an exception is thrown.

Based on the bundle name, you can now reference any resource with this
notation:

    @FooBundle/Resources/config/routing.xml
    @FooBundle/Controller/FooController.php

This notation is the input of the Kernel::locateResource() method, which
returns the location of the file (and of course it takes into account
overloading).

So, in the routing, you can now use the following:

    <import resource="@FrameworkBundle/Resources/config/internal.xml" />

The template loading mechanism also use this method under the hood.

As a bonus, all the code that converts from internal notations to file names
(controller names: ControllerNameParser, template names: TemplateNameParser,
resource paths, ...) is now contained in several well-defined classes. The
same goes for the code that look for templates (TemplateLocator), routing
files (FileLocator), ...

As a side note, it is really easy to also support multiple-inheritance for a
bundle (for instance if a bundle returns an array of bundle names it extends).
However, this is not implemented in this patch as I'm not sure we want to
support that.

How to upgrade:

 * Each bundle must now implement two new mandatory methods: getPath() and
   getNamespace(), and optionally the getParent() method if the bundle extends
   another one. Here is a common implementation for these methods:

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return 'MyFrameworkBundle';
    }

    /**
     * {@inheritdoc}
     */
    public function getNamespace()
    {
        return __NAMESPACE__;
    }

    /**
     * {@inheritdoc}
     */
    public function getPath()
    {
        return strtr(__DIR__, '\\', '/');
    }

 * The registerBundleDirs() can be removed from your Kernel class;

 * If your code relies on getBundleDirs() or the kernel.bundle_dirs parameter,
   it should be upgraded to use the new interface (see Doctrine commands for
   many example of such a change);

 * When referencing a bundle, you must now always use its name (no more \ or /
   in bundle names) -- this transition was already done for most things
   before, and now applies to the routing as well;

 * Imports in routing files must be changed:
    Before: <import resource="Sensio/CasBundle/Resources/config/internal.xml" />
    After:  <import resource="@SensioCasBundle/Resources/config/internal.xml" />
2011-01-20 18:42:47 +01:00
Dominique Bongiraud
68ef032064 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00