Skip to content
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

[Transformer] We should throw an exception when we try to transform an invalid index #117

Open
FabienSalles opened this issue Apr 28, 2020 · 0 comments

Comments

@FabienSalles
Copy link
Contributor

FabienSalles commented Apr 28, 2020

Description

The mapping transformer uses Symfony's PropertyAccess component in order to set values.
When mappings are incorrect we need to configure the component properly if we want to see exceptions :

framework:
    property_access:
        throw_exception_on_invalid_index: true
        throw_exception_on_invalid_property_path: true

After this, we can see an exception when we have an invalid index but the second one never trigger because if the property is not writable we set the value without the property access
https://github.com/cleverage/process-bundle/blob/v3.1-dev/Transformer/MappingTransformer.php#L144

We need to remove the fallback with the array or trigger an exception before if the property does not exist

@FabienSalles FabienSalles changed the title [Transformer] We don't have an error when we try to transform an invalid index [Transformer] We should throw an exception when we try to transform an invalid index Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants