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
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
/zend-mvcPublic archive

FixedFormAnnotationBuilderFactory::injectFactory() for zend-servicemanager v2#235

Conversation

@weierophinney
Copy link
Member

The patch introduced for 2.7.11 was incorrect in that it was passing the$container argument, and not the$formElementManager argument, to$formElementManager->injectFactory(). This patch updates it to use the correct value, and fixes the related test expectation as well.

cc@boesing

…emanager v2The patch introduced for 2.7.11 was incorrect in that it was passing the`$container` argument, and not the `$formElementManager` argument, to`$formElementManager->injectFactory()`. This patch updates it to use thecorrect value, and fixes the related test expectation as well.
@weierophinney
Copy link
MemberAuthor

@boesing — You can test this as follows.

  1. Add arepositories entry for my fork to yourcomposer.json:

    "repositories": [     {"type":"vcs","url":"https://github.com/weierophinney/zend-mvc" } ]
  2. Add the followingrequire statement incomposer.json:

    "zendframework/zend-mvc":"dev-hotfix/annotation-builder as 2.7.12",
  3. Runcomposer update zenframework/zend-mvc

Let me know if this works for you.

@weierophinneyweierophinney added this to the2.7.12 milestoneApr 27, 2017
@boesing
Copy link
Member

This works for me. Thanks a lot! I am still confused about that self injectingFormElementManager.

) {
if ($formElementManagerinstanceof FormElementManagerV2Polyfill) {
$formElementManager->injectFactory($annotationBuilder,$container);
$formElementManager->injectFactory($annotationBuilder,$formElementManager);
Copy link
Member

Choose a reason for hiding this comment

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

Why would the formElementManager inject itself? I still dont get the meaning of this.

Copy link
Member

Choose a reason for hiding this comment

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

The v3 implementation is therefore passing the real container.
You totally irritated me on this now 🙈

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It's a difference in how plugin managers work between version 2 and version 3.

In version 2, plugin managers pass themselves as the$container/$serviceLocator argument to factories and initiailizers. The idea at the time was to keep the plugin managers scoped; they would know nothing about the application-level services. However, we quickly realized this was problematic: most of the time, particularly with custom plugins, you need to access application-level services, such as the database connection, repositories, etc. So we made the plugin managersServiceLocatorAware, so they would be injected with the parent (application) plugin manager, allowing plugin factories and initializers access to those services.

When we refactored the component for v3, we took this into consideration, and decided that plugin managers should be injected with the parent "context" (usually the application-level service manager), and that the parent context should be passed to plugin factories and initializers. This reduces the amount of boilerplate necessary for the vast majority of these classes, as it addresses the most typical use case.

Obviously, however, that has also meant some interesting migration issues when trying to provide both forwards compatibility with v3 implementations, and backwards compatibility with v2. You just stumbled upon one of the worst. 😁

boesing reacted with thumbs up emoji
Copy link
Member

@boesingboesingApr 27, 2017
edited
Loading

Choose a reason for hiding this comment

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

When we refactored the component for v3, we took this into consideration, and decided that plugin managers should be injected with the parent "context" (usually the application-level service manager), and that the parent context should be passed to plugin factories and initializers. This reduces the amount of boilerplate necessary for the vast majority of these classes, as it addresses the most typical use case.

Makes sense, I dont think that anyone wants create anotherController in aControllerFactory 😁.

Thanks for your patience and for those great insights of what was changed, e.g.

@weierophinneyweierophinney merged commitbc09e87 intozendframework:release-2.7Apr 27, 2017
weierophinney added a commit that referenced this pull requestApr 27, 2017
@weierophinneyweierophinney deleted the hotfix/annotation-builder branchApril 27, 2017 15:44
@weierophinney
Copy link
MemberAuthor

Released as 2.7.12.

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

Reviewers

1 more reviewer

@boesingboesingboesing approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

Projects

None yet

Milestone

2.7.12

Development

Successfully merging this pull request may close these issues.

2 participants

@weierophinney@boesing

[8]ページ先頭

©2009-2025 Movatter.jp