Closed mike4git closed 4 months ago
This PR would also mean, that with the following config:
# config/packages/neusta_converter.yaml
neusta_converter:
converter:
person.converter:
# ...
properties:
email: ~
phone: ''
the email would be populated from the target field email
to the source field email
while the for phone, the source object would be populated into the target field phone
.
Would that be correct, and is this what we want?
I'd rather suggest that both ~
and ''
should do the same here.
What do you think?
This PR would also mean, that with the following config:
# config/packages/neusta_converter.yaml neusta_converter: converter: person.converter: # ... properties: email: ~ phone: ''
the email would be populated from the target field
phone
.Would that be correct, and is this what we want?
I'd rather suggest that both
~
and''
should do the same here. What do you think?
I see your point but for some circumstances it is necessary that the "complete" source object should be populated into a certain target property. Should we write a new config for that?
What about a certain Populator type?!
I see your point but for some circumstances it is necessary that the "complete" source object should be populated into a certain target property.
But do you need it at this place? If I understood correctly, you wanted to use this especially together with the ConvertingPopulator
?
What would you think about the following syntax:
# config/packages/neusta_converter.yaml
neusta_converter:
converter:
person.converter:
# ...
properties:
email: ~
phone: this
So, as you mentioned:
The complete source object will be converted into phone target property.
I really like this idea!
But I would suggest using $this
as the keyword. Then it is easier to recognize that it is not a normal field name.
As mentioned in the issue: Sometimes you want to populate the complete (source) object in a certain target attribute/property. With that PR it is quite simple possible.
Closes #58