Skip to content

Commit

Permalink
minor #11684 [DX] Removed strict alias name check (WouterJ)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.6-dev branch.

Discussion
----------

[DX] Removed strict alias name check

Symfony allows to change the DI alias by overriding `Extension#getAlias()`, but it does throw an exception when it is anything else than the default. That doesn't sound nice and it makes it harder to change the alias. This can result in problems when the bundle is called WouterJEloquentBundle for instance (which has a default alias of `wouter_j_eloquent_bundle`, where I want it to be `wouterj_eloquent_bundle`).

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

69d71c1 Made the exception message nicer
  • Loading branch information
fabpot committed Aug 31, 2014
2 parents 4b53873 + 69d71c1 commit c00c8fd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/Symfony/Component/HttpKernel/Bundle/Bundle.php
Expand Up @@ -82,9 +82,7 @@ public function getContainerExtension()
$expectedAlias = Container::underscore($basename);
if ($expectedAlias != $extension->getAlias()) {
throw new \LogicException(sprintf(
'The extension alias for the default extension of a '.
'bundle must be the underscored version of the '.
'bundle name ("%s" instead of "%s")',
'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.',
$expectedAlias, $extension->getAlias()
));
}
Expand Down

0 comments on commit c00c8fd

Please sign in to comment.