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 a new LazyCallable type for injecting callable services #129

Merged
merged 1 commit into from Jun 14, 2016
Merged

Add a new LazyCallable type for injecting callable services #129

merged 1 commit into from Jun 14, 2016

Conversation

djmattyg007
Copy link
Contributor

It's possible for code to expect to take a callable and invoke it
multiple times (sequentially, not recursively) with parameters that are
only known at calltime. This patch makes it possible to use services
configured in the dependency injection container as callables that fit
the above definition.

The LazyCallable type differs from the Lazy type in two ways:

  1. Lazy expects all callable parameters to be configured when it is
    created. LazyCallable expects all callable parameters to be supplied
    at calltime.
  2. Lazy expects to only be called once. LazyCallable expects to be
    called multiple times.

It's possible for code to expect to take a callable and invoke it
multiple times (sequentially, not recursively) with parameters that are
only known at calltime. This patch makes it possible to use services
configured in the dependency injection container as callables that fit
the above definition.

The LazyCallable type differs from the Lazy type in two ways:

1. Lazy expects all callable parameters to be configured when it is
   created. LazyCallable expects all callable parameters to be supplied
   at calltime.
2. Lazy expects to only be called once. LazyCallable expects to be
   called multiple times.
@pmjones
Copy link
Member

pmjones commented Jun 14, 2016

Huh. Also cool.

@pmjones pmjones merged commit 77b6597 into auraphp:3.x Jun 14, 2016
@jakejohns
Copy link
Member

@djmattyg007, Does this need an updated section in the docs?

@pmjones
Copy link
Member

pmjones commented Jun 14, 2016

Ah yes, that's a good call @jakejohns . @djmattyg007 if you can add a relevant docs PR that would be helpful.

@djmattyg007
Copy link
Contributor Author

I could have sworn I already did that. I'll put up another PR tonight!

@djmattyg007 djmattyg007 deleted the add_lazy_callables branch June 16, 2016 22:02
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.

None yet

3 participants