Skip to content

Add an auto_alias compiler pass #12526

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Conversation

dawehner
Copy link
Contributor

Discussion see #11460

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets [#11460]
License MIT
Doc PR symfony/symfony-docs#4992

*/
public function process(ContainerBuilder $container)
{
foreach ($container->findTaggedServiceIds('auto_alias') as $service_id => $tags) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only use camelCase variables in Symfony. Can you make the change everywhere? Thanks.

@dawehner
Copy link
Contributor Author

Updated the PR.


$parameterValue = $container->getParameter($parameterName);
$format = $tag['format'];
$aliasId = str_replace('%s', $parameterValue, $format);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not sprintf($format, $parameterValue)?

@dawehner
Copy link
Contributor Author

@inso
@fabpot
Thank you for all your feedback. Adressed it.

@dawehner
Copy link
Contributor Author

PS: We could add a "Drupal" label onto this issue

@fabpot
Copy link
Member

fabpot commented Nov 20, 2014

tag added

{
foreach ($container->findTaggedServiceIds('auto_alias') as $serviceId => $tags) {
// We don't want to deal with an existing alias.
if ($container->hasAlias($serviceId)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually not possible, given that aliases cannot have tags, only services can.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, good to know!

@dawehner
Copy link
Contributor Author

Should we now make PRs against 2.7 for now or is 3.x the proper version and things are just broken atm.?

@fabpot
Copy link
Member

fabpot commented Feb 12, 2015

Thank you @dawehner.

@fabpot fabpot closed this in 2d48266 Feb 12, 2015
@wouterj
Copy link
Member

wouterj commented Apr 15, 2016

Am I correct that this pass is not registered anywhere by default?

@xabbuh
Copy link
Member

xabbuh commented Apr 15, 2016

@wouterj Yes, seems like this was missed.

@jean-pasqualini
Copy link
Contributor

@wouterj @xabbuh @nicolas-grekas @fabpot
Why do we keep this feature if it is not wired?

@xabbuh
Copy link
Member

xabbuh commented Jan 17, 2017

@jean-pasqualini The best is to open a new issue so this doesn't get lost again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants