Skip to content

Add getDefinitionByType() method #130

@TomasVotruba

Description

@TomasVotruba

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions