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] fix using bindings with locators of service subscribers#31541

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
nicolas-grekas merged 1 commit intosymfony:3.4fromnicolas-grekas:di-locator-bind
May 22, 2019

Conversation

@nicolas-grekas
Copy link
Member

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

Spotted during the workshop in Sao Paulo, with@tsantos84,@andreia and others :)

tsantos84 reacted with thumbs up emojiandreia reacted with heart emojiandreia reacted with rocket emoji
thrownewInvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".',$this->currentId,\is_object($v) ?\get_class($v) :\gettype($v),$k));
}

if (\is_int($k)) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This fix is borrowed from 4.2.


require_once__DIR__.'/../Fixtures/includes/classes.php';

class ServiceLocatorTagPassTestextends TestCase
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Test class borrowed from 4.2.

$this->assertSame(TestDefinition1::class,\get_class($locator('bar')));
}

publicfunctiontestBindingsAreCopied()
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The new test case for this fix.

@nicolas-grekasnicolas-grekas merged commit7146b95 intosymfony:3.4May 22, 2019
nicolas-grekas added a commit that referenced this pull requestMay 22, 2019
…rs (nicolas-grekas)This PR was merged into the 3.4 branch.Discussion----------[DI] fix using bindings with locators of service subscribers| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Spotted during the workshop in Sao Paulo, with@tsantos84,@andreia and others :)Commits-------7146b95 [DI] fix using bindings with locators of service subscribers
$locator->setBindings($container->getDefinition($callerId)->getBindings());
}

if (!$container->hasDefinition($id ='service_locator.'.ContainerBuilder::hash($locator))) {
Copy link
Member

Choose a reason for hiding this comment

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

are bindings taken into account by the hashing ? If no, that would cause issues.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

correct, hash() uses serialize() so all the state is hashed

@fabpotfabpot mentioned this pull requestMay 28, 2019
@nicolas-grekasnicolas-grekas deleted the di-locator-bind branchMay 28, 2019 10:30
This was referencedMay 28, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

3 participants

@nicolas-grekas@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp