Skip to content

Commit

Permalink
Revert "DI: 'inject' option is enabled by default (experimental)"
Browse files Browse the repository at this point in the history
This reverts commit d5b8b05ffbd032c11205a76b047def0a1ae295ba.
  • Loading branch information
dg committed Jun 20, 2014
1 parent 13c732c commit a0333bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Application/PresenterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public function createPresenter($name)
$presenter = $this->container->createService($services[0]);
} else {
$presenter = $this->container->createInstance($class);
$this->container->callInjects($presenter);
}
$this->container->callInjects($presenter);

if ($presenter instanceof UI\Presenter && $presenter->invalidLinkMode === NULL) {
$presenter->invalidLinkMode = $this->container->parameters['debugMode'] ? UI\Presenter::INVALID_LINK_WARNING : UI\Presenter::INVALID_LINK_SILENT;
Expand Down

6 comments on commit a0333bd

@fprochazka
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think this revert could be reverted? I think that if you put the presenters in DI Container, you should either turn on the injects on the presenter services by hand, or with some automatic mechanism. Because having the injects statically generated in the DI Container is the preferred way over dynamically resolving them on every request.

This line just makes zero sense to me outside the else branch. What do you think?

@fprochazka
Copy link
Contributor

Choose a reason for hiding this comment

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

Also this is a thing

@dg
Copy link
Member Author

@dg dg commented on a0333bd Aug 30, 2014

Choose a reason for hiding this comment

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

Now is inject tag and it can be detected in runtime.

@fprochazka
Copy link
Contributor

Choose a reason for hiding this comment

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

That would probably work too! Good idea.

@davidkrmela
Copy link
Contributor

Choose a reason for hiding this comment

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

And how this feature (checking inject tag) allows to disable auto-inject to presenter?

If I register presenter as service and I give him dependencies on my own, PresenterFactory via $this->container->callInjects($presenter) makes second redundant inject. I think that this revert should be reverted.

@fprochazka
Copy link
Contributor

Choose a reason for hiding this comment

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

@davidkrmela it's solved in dev version.

Please sign in to comment.