-
Notifications
You must be signed in to change notification settings - Fork 222
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 support for multiple "argsBuilder" #321
Comments
@Kocal
edit Think for the first its useful to behave like the argsBuilder currently does. The question is whether to propagate this logic to args builderS due to maybe confusing situation when you use multiple builders and they mess each other up. This is why with the ability to add types in builder(s) #473 I went the routine of denying overrides. The question is whether it gets confusing when all the builders behave differently in this case. So take this just as a thought for future and ignore the first point :) |
Ah you're right, I didn't think about this.
class MySecondArgsBuilder implements MappingInterface
{
public function toMappingDefinition(array $config, array $parentDefinition): array
{
// Here, `$parentDefinition` is the result of the previous args builder `MyFirstArgsBuilder`
$definition = [
'bar' => [
'type' => 'Int',
],
];
return $parentDefinition + $definition;
}
} |
I would not yet touch the MappingInterface as it is used in too many different places. Maybe I phrase the focus of the question differently: Do you think an arg builder replacing args from other arg builder is rather not an error and you want to allow it or rather error you want to know about at compile time after changing the config. |
... I don't know, both solutions seem good to me ¯\(ツ)/¯ |
As discussed on a Slack thread, that would be awesome to have the possibility to write something like that:
It would prevent to us to write something not flexible at all:
Also, it should handle argument name conflicts. For example, it should throw an exception if
MyFirstArgsBuilder
andMySecondArgsBuilder
both providefoo
argument.Thanks!
The text was updated successfully, but these errors were encountered: