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

[DI] Anonymous services support for YamlFileLoader#16328

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

Conversation

@prgTW
Copy link

QA
Bug fix?no
New feature?yes
BC breaks?yes
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Example:

services:first:class:FooClassarguments:[ { type: service, class: BazClass } ]second:class:FooClassarguments:            -type:serviceclass:BazClass            -type:serviceclass:BarClass

@prgTWprgTWforce-pushed thefeat/di/yaml-loader-anonymous-services branch 2 times, most recently fromc90fa7f to4f282e8CompareOctober 23, 2015 23:25
@prgTWprgTWforce-pushed thefeat/di/yaml-loader-anonymous-services branch from4f282e8 to455375fCompareOctober 23, 2015 23:26
@SongoQ
Copy link
Contributor

👍

@sstok
Copy link
Contributor

This is a BC break as an argument can also an array, and there is no way to determine if it is in fact an array with the key 'type' or a service definition.

@prgTW
Copy link
Author

You re right, it's a BC break. IMHO I'm introducing a convention here which is similar to @/@@/@?/@= notation. I wanted to do it as similar as it could be comparing with XML format and thus having steep learning curve

@linaori
Copy link
Contributor

I can understand the need for this, but I don't think this current implementation is the correct one.

Can you add some more information about what you're changing and why you're changing it? It will help people to understand the PR a lot better.

@stof
Copy link
Member

-1 on the current implementation. Such BC break is impossible. It is far too big (imagine the case where you inject an array in your service without knowing its content as it comes from the user config)

@xabbuh
Copy link
Member

Status: Needs work

@fabpot
Copy link
Member

Closing as it cannot be merged and I don't see a huge benefit in being able to create anonymous services in userland. For core and bundles, it's recommended to use XML anyway where anonymous services are supported.

@fabpotfabpot closed thisOct 25, 2015
@prgTWprgTW deleted the feat/di/yaml-loader-anonymous-services branchOctober 25, 2015 18:57
@GuilhemN
Copy link
Contributor

I opened#21970 which allows anonymous services in yaml using the!service tag.

fabpot added a commit that referenced this pull requestMar 14, 2017
…ml (GuilhemN)This PR was merged into the 3.3-dev branch.Discussion----------[DependencyInjection] Support anonymous services in Yaml| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes <!-- don't forget updating src/**/CHANGELOG.md files -->| BC breaks?    | no| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->| Tests pass?   | yes| Fixed tickets |#16328| License       | MIT| Doc PR        |This PR allows creating anonymous services in yaml using the `!service` tag as proposed by@nicolas-grekas:```ymlservices:    _instanceof:        FooInterface:            arguments:                - !service                    class: Bar                    autowire: true    Foo:        factory: [ !service { class: Quz }, 'constructFoo' ]```Anonymous services are forbidden in parameters as in xml.Defaults and instanceof conditionals aren't applied on anonymous services, as in xml too.Commits-------9b71385 [DependencyInjection] Support anonymous services in Yaml
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

9 participants

@prgTW@SongoQ@sstok@linaori@stof@xabbuh@fabpot@GuilhemN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp