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
Autowire services that implement NamerInterface #1448
Comments
If we have to add a compiler pass, why don't do something to properly inject the configured service for the namer? |
To elaborate a bit on my previous comment: I was thinking about injecting two services into PropertyMappingResolver, a PRs are welcome. |
A directory namer would be cool. In fact, my custom namer really is only the directory. $file = $mapping->getFile($object);
$name = $file->getClientOriginalName();
/** @var $object Project|Asset */
$name = match ($object::class) {
Project::class => sprintf("%s/%s", $object->getSlug(), $name),
Asset::class => sprintf("%s/%s/%s", $object->getProject()->getSlug(), $object->getItem()->getCode(), $name),
};
return $name; |
Feature Request
Summary
Instead or requiring namer services to be manually registered.
The compiler pass could look for services that implement NamerInterface and make them public. One less step when creating a custom namer service.
The text was updated successfully, but these errors were encountered: