Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DependencyInjection] Allow loading and dumping tags with an attribute named "name"#18802

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

alexandre-daubois
Copy link
Member

@alexandre-dauboisalexandre-daubois commentedAug 30, 2023
edited
Loading

Not an easy one to fully understand. Friendly ping@stof as you participated to the issue 🙂 Thanks!

Fix#13613

@@ -515,6 +515,45 @@ To answer this, change the service declaration:
;
};

.. tip::

In XML and YAML format, you may provide the tag an attribute called ``name``.

Choose a reason for hiding this comment

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

I don't understand this "feature".

  • Is thename attribute special here?
  • If it's special: what does that imply?
  • If it's not special: why mention this at all? If it's just like any other attribute, why mention thisname attribute in particular?

Thanks!

Copy link
MemberAuthor

@alexandre-dauboisalexandre-dauboisAug 31, 2023
edited
Loading

Choose a reason for hiding this comment

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

Thename attribute is not special itself. Actually, this tip indicates that you can use an attribute namedname, which wasn't possible before 5.1. Also, this shows that if you need to add aname attribute on a tag, youmust use a "special" syntax. Otherwise, thename attribute will be interpreted asthe tag name, not as an attribute of it.

By doing

MailerSendmailTransport:tags:        -{ name: 'app.mail_transport', alias: 'sendmail' }

You declare a tag with theapp.mail_transport nameand an attribute calledalias. This is a bit misleading becausealias andname keys are at the same level. If you actually need an attribute calledname, you must do the following:

MailerSmtpTransport:arguments:['%mailer_host%']tags:            -app.mail_transport:{ name: 'arbitrary-value', alias: 'smtp' }

It took me some time to fully understand what this PR was all about 😄

Copy link
Member

Choose a reason for hiding this comment

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

By default, thename XML attribute contains the tag name, and so cannot be used to set an attribute namedname. As of 5.1, there is a way to usename as an attribute by passing the tag name in the body of the XML element instead.

Choose a reason for hiding this comment

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

Thanks for your explanation. Now I can fully understand what's happening here. So, I've done some tweaks while merging to hopefully make it less confusing to readers:6e6565b

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Perfect! 🙂

@javiereguiluzjaviereguiluz merged commit8683ab5 intosymfony:5.4Aug 31, 2023
@javiereguiluz
Copy link
Member

Alex, thanks a lot for contributing this ... and congrats on completing theSymfony 5.1 milestone 🎉

alexandre-daubois reacted with hooray emojialexandre-daubois reacted with rocket emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz left review comments

@stofstofstof approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
6.4
Development

Successfully merging this pull request may close these issues.

[DI] allow loading and dumping tags with an attribute named "name"
5 participants
@alexandre-daubois@javiereguiluz@stof@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp