Skip to content
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

Parent presenter usage ends with "Multiple services of type ... found" #258

Closed
KacerCZ opened this issue Apr 1, 2020 · 4 comments
Closed

Comments

@KacerCZ
Copy link

KacerCZ commented Apr 1, 2020

Version: 3.0.4

Bug Description

When presenter class is inherited to another presenter, then parent presenter usage ends with error "Multiple services of type ... found"

Steps To Reproduce

Create presenter with name ParentPresenter and another presenter ChildPresenter inheriting from ParentPresenter.
Add presenters to composer classmap and dump optimized class loader.
Try access ParentPresenter and BadRequestException is thrown with message "Multiple services of type ..."

Expected Behavior

I expect ParentPresenter to be run as was in version 2.4.

@mabar
Copy link
Contributor

mabar commented Apr 1, 2020

If you request a service and multiple services with same type are found, then error is correct. Parent presenter should either be abstract or you can set autowired option so service is wired only by specific name

@KacerCZ
Copy link
Author

KacerCZ commented Apr 1, 2020

Method ApplicationExtension::beforeCompile() already disables autowiring of all presenters.
Class PresenterFactoryCallback then uses findByType() and multiple services are returned for ParentPresenter.

@dg
Copy link
Member

dg commented Apr 1, 2020

It is due to cb35435

@KacerCZ
Copy link
Author

KacerCZ commented Apr 27, 2020

I've updated to nette/application 3.0.5 and its working as expected.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants