This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle
Fabien Potencier 063e6f9ae6 merged branch Seldaek/commands (PR #1470)
Commits
-------

d675c28 [FrameworkBundle] Use Router instead of RouterInterface
ae7ae8d [FrameworkBundle] Moved router_listener from web to router.xml since it depends on the router
35a9023 [FrameworkBundle] Added isEnabled to Router commands, fixes #1467
536d979 [Console] Added Command::isEnabled method that defines whether to add the command or not

Discussion
----------

[2.1] [Console] Added Command::isEnabled method

This addresses #1467.

The idea is to allow commands to evaluate whether they can run or not, since they are automatically registered.

- It's useful for the two router:* commands since they're optional (router can be disabled), but part of the FrameworkBundle that is not really optional.
- It could be useful for third party code as well.
- It's BC.
- aa95bb0d395810b29a3e654673e130736d9d1080 should address the issue in #1467, while the other commits just make sure the command is not registered at all if the router isn't standard.

One issue remains though:

- A few other services like twig helpers get the `ròuter` injected, this means that if there is really **no** router service defined, there is still an error. I'm not sure how to fix those beyond adding `on-invalid="null"` but I'm not sure if that's desirable. I guess we could argue that the router is a big candidate for replacement/suppression, and as such it should be truly optional, but if we do it I don't know where it'll lead. I don't want to end up in a situation where half the dependencies are optional to support every possible combination. @fabpot wdyt?

---------------------------------------------------------------------------

by kriswallsmith at 2011/06/28 16:19:46 -0700

I'd rather see us not register a command instead of register and then disable it. Can we do the same thing you've done here in the bundle's registerCommands() method?

---------------------------------------------------------------------------

by Seldaek at 2011/06/28 16:51:36 -0700

Note that it's never really registered. During the registration it's checked and skipped if not enabled.

However, doing it as you suggest means overriding/copy-pasting all the code from the core Bundle class, which I don't like so much. It also means adding code specific to those two commands in a somewhat unrelated place, which I also don't like.

I'm not saying the current solution is perfect, but from the alternatives I considered, it's the best I have found.

---------------------------------------------------------------------------

by stof at 2011/09/04 04:58:04 -0700

@Seldaek your branch conflicts with master. could you rebase it ?

@fabpot what do you think about this PR ?

---------------------------------------------------------------------------

by Seldaek at 2011/09/04 08:39:05 -0700

Rebased
2011-09-27 15:48:10 +02:00
..
CacheWarmer simplified cache warmers 2011-06-07 11:42:27 +02:00
Command merged branch Seldaek/commands (PR #1470) 2011-09-27 15:48:10 +02:00
Console fixed CS 2011-06-08 12:12:55 +02:00
Controller Revert "expanded namespaces within phpdoc (special for PhpStorm)" 2011-08-13 19:27:36 +02:00
DataCollector Renamed core.* events to kernel.* and CoreEvents to KernelEvents 2011-06-21 16:35:14 +02:00
Debug [FrameworkBundle] Changed TraceableEventDispatcher to log calls to event listeners _before_ actually calling them 2011-07-23 10:49:25 +02:00
DependencyInjection merged branch schmittjoh/translationFixes (PR #2213) 2011-09-20 07:43:26 +02:00
EventListener [HttpFoundation] changed the strategy introduced in a5ccda47b4 to fix functional tests and still allow to call save more than once for a Session 2011-09-14 20:54:45 +02:00
HttpCache [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Resources merged branch Seldaek/commands (PR #1470) 2011-09-27 15:48:10 +02:00
Routing [FrameworkBundle] added sc parameters replacement in route requirements 2011-09-14 09:19:55 +02:00
Templating merged branch lsmith77/template_locator (PR #2128) 2011-09-23 21:00:46 +02:00
Test converted file_exists calls to either is_file or is_dir where it makes sense 2011-08-29 15:28:26 +02:00
Tests [FrameworkBundle] fixed a unit test 2011-09-19 08:55:18 +02:00
Translation some more fixes 2011-09-19 16:37:34 +02:00
Validator updated my email address 2011-05-02 05:59:56 -07:00
Client.php added missing ' escaping 2011-07-22 13:37:23 +02:00
ContainerAwareEventDispatcher.php Fix Method ContainerAwareEventDispatcher::hasListeners 2011-08-31 10:39:33 +02:00
FrameworkBundle.php -- add command that extracts translation messages from templates 2011-09-09 10:23:54 +02:00
HttpKernel.php Fixed the creation of the subrequests 2011-09-18 00:24:28 +02:00