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
Type Validator not working because of a cast in the mutator #283
Comments
@LeandroLuccerini thanks, could you write a PR with you fix? |
This change adds another bug. If you pass an object to the setter of a string field it would not be casted as string and thus the behavior of the field might become unpredictable. This might happen if a column getter was overriden either by user or by the behavior. It brings me much trouble. |
@dancy could you provide a unit test or a more concrete example? |
I don't know how to create a unit test for Propel correctly. If anyone could explain me it would be great. |
Hi everybody,
i've found that if you have a column defined as type correspondig to a php primitive in the schema.xml (FLOAT, INT, DOUBLE, BOOLEAN) and you add a type validator, it doesn't work because of a cast added in the addDefaultMutator method of the PHP5ObjectBuilder.php
Example
This will generate the setter down below
So if you set the value using $obj->setPf1EurkwhSim("Hello") and then you call the validate() method it will return true because of the cast of the string "Hello" to a double (so = 0).
Since i wanted to catch the error in this case i have updated the addDefaultMutator() method
I hope it could be useful. If there are mistakes or known issues with this, please let me know.
Thank you.
The text was updated successfully, but these errors were encountered: