10000 [DIC] Factory + TaggedLocator does not work with defaultIndexMethod · Issue #57830 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DIC] Factory + TaggedLocator does not work with defaultIndexMethod #57830

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
lyrixx opened this issue Jul 25, 2024 · 0 comments
Closed

[DIC] Factory + TaggedLocator does not work with defaultIndexMethod #57830

lyrixx opened this issue Jul 25, 2024 · 0 comments

Comments

@lyrixx
Copy link
Member
lyrixx commented Jul 25, 2024

Symfony version(s) affected

5.4.40

Description

Using a factory, and tagged locator does not work

services:
    App\Jerome\JeromeInterface:
        factory: ['@App\Jerome\ImplemSelector', selectImplem]
class ImplemSelector
{
    public function __construct(
        #[TaggedLocator(JeromeInterface::class, defaultIndexMethod: 'getNameStoredInDb')]
        private readonly ServiceLocator $serviceLocator
    ) {
    }

    public function selectImplem(): JeromeInterface
    {
        $name = ['first', 'second'][random_int(0, 1)];

        return $this->serviceLocator->get($name);
    }
}

How to reproduce

I made a reproducer

Possible Solution

No response

Additional Context

No response

@lyrixx lyrixx added the Bug label Jul 25, 2024
fabpot added a commit that referenced this issue Jul 26, 2024
< 6096 input type="hidden" name="oid" value="dbccb6b6988541122a8a554785f30ca49b252def" autocomplete="off" data-targets="batch-deferred-content.inputs" />
…me on interface (lyrixx)

This PR was merged into the 5.4 branch.

Discussion
----------

[DependencyInjection] Do not try to load default method name on interface

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #57830
| License       | MIT

Commits
-------

ac78bba [DependencyInjection] Do not try to load default method name on interface
@fabpot fabpot closed this as completed Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0