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

Add getDefinitionByType() method #130

Closed
TomasVotruba opened this issue Dec 10, 2016 · 1 comment
Closed

Add getDefinitionByType() method #130

TomasVotruba opened this issue Dec 10, 2016 · 1 comment

Comments

@TomasVotruba
Copy link
Contributor

@TomasVotruba TomasVotruba commented Dec 10, 2016

While making extension, I often need some service definition in beforeCompile() method, e.g.:

After making service name optional, this is the only place where it is still required.

Everywhere I need some definition, I have to use these 2 methods:

$containerBuilder = $this->getContainerBuilder();
$serviceName = $containerBuilder->getByType(Nette\Bridges\ApplicationLatte\ILatteFactory::class);
$serviceDefinition = $containerBuilder->getDefinition($serviceName);

I would prefer having single method:

$serviceDefinition = $containerBuilder->getDefinitionByType(
    Nette\Bridges\ApplicationLatte\ILatteFactory::class
);

What do you think?

@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Dec 19, 2016

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.