Being able to pass container as an option means Repository can work with an all-options constructor signature, which makes it easier to inject additional app-specific dependencies to subclasses using tools like dry-auto_inject (with its standard kwargs strategy).
This change is backwards compatible because the standard param continues to be respected.
So now you can initialize a repo in both these ways:
UserRepo.new(rom)
UserRepo.new(container: rom)
And here's an example of how it'd with with dry-auto_inject:
module MyApp
class Repo < ROM::Repository
include Import[container: "persistence.rom"]
end
class UserRepo < Repo
include Import["another_dep"]
# container is injected via superclass
# can also work with `another_dep` inside instance methods here
end
end
Being able to pass
container
as an option means Repository can work with an all-options constructor signature, which makes it easier to inject additional app-specific dependencies to subclasses using tools like dry-auto_inject (with its standard kwargs strategy).This change is backwards compatible because the standard param continues to be respected.
So now you can initialize a repo in both these ways:
And here's an example of how it'd with with dry-auto_inject:
@solnic @flash-gordon How's this look to you?