Skip to content

[ContainerBuilder] getDefinitionByType() method added#137

Merged
dg merged 1 commit into
nette:masterfrom
TomasVotruba:get-definition-by-type
Jan 7, 2017
Merged

[ContainerBuilder] getDefinitionByType() method added#137
dg merged 1 commit into
nette:masterfrom
TomasVotruba:get-definition-by-type

Conversation

@TomasVotruba

Copy link
Copy Markdown
Contributor

All is described in the issue: #130

Behavior is compatible with with getDefiniton() - exception is thrown when not found.
This method is called in cases where Definition is required.

@TomasVotruba

Copy link
Copy Markdown
Contributor Author

Ping @dg

@dg

dg commented Jan 7, 2017

Copy link
Copy Markdown
Member

@TomasVotruba

TomasVotruba commented Jan 7, 2017

Copy link
Copy Markdown
Contributor Author

What needs to be done here?

@dg

dg commented Jan 7, 2017

Copy link
Copy Markdown
Member

Can it return NULL?

@TomasVotruba

TomasVotruba commented Jan 7, 2017

Copy link
Copy Markdown
Contributor Author

Well, that was my first idea. But having getDefiniton() throwing exception and getDefinitonByType() giving NULL seems inconsistent.

What do you think?

@dg

dg commented Jan 7, 2017

Copy link
Copy Markdown
Member

So annotation @return should be fixed.

@TomasVotruba

Copy link
Copy Markdown
Contributor Author

I see. That is leftover from 1st idea.

Fixed!

@dg

dg commented Jan 7, 2017

Copy link
Copy Markdown
Member

Great, thanks!

@dg dg merged commit 5ea207b into nette:master Jan 7, 2017
@TomasVotruba

Copy link
Copy Markdown
Contributor Author

Awesome, thanks a lot!

@TomasVotruba

Copy link
Copy Markdown
Contributor Author

For others, here are all use cases I used it in:

deprecated-packages/symplify@1e8854c

Requires nette\di 2.4.6+

Comment thread src/DI/ContainerBuilder.php Outdated
/**
* Gets the service definition of the specified type.
* @param string
* @return ServiceDefinition|NULL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can it return NULL?

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

Successfully merging this pull request may close these issues.

2 participants