Closed danielsetreus closed 4 years ago
That is not something I plan on implementing: it is out of the scope of the container (those are route parameters, not container services/parameters) and we are approaching the magic of full-fledge frameworks like Laravel/Symfony.
I mean, the feature makes sense, but to me it's a feature that could be implemented in a 3rd party package.
Consider this:
index.php
FooController.php
DateTimeDto.php
Would it today be possible to inject
DateTimeDto
intobarMethod
constructing it with the optional value in the route? I.e.GET /foo/2019-01-01
would injectnew DateTimeDto('2019-01-01')
In essence what I want is to automatically cast a placeholder value to an arbitrary type. For all I know it works when casting the value to a
int
, but not with dependency injections.