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

EntityDefinition@getField $default parameter should not be null #99

Open
planeth44 opened this issue Jul 3, 2018 · 5 comments
Open
Milestone

Comments

@planeth44
Copy link

planeth44 commented Jul 3, 2018

when you submit a form and fields are not required –if the type is text– the values are an empty string.
the getField function replace these empty string value by a null value which breaks the SQL schema of NOT NULL if the definition is VARCHAR

@philiplb
Copy link
Owner

philiplb commented Jul 3, 2018

Hi,
the idea of the required-flag is to reflect the NOT NULL constraint. It is called "required" due to the possibility to have non SQL-implementations.
My practice is:
required = true -> NOT NULL
required = false -> NULLABLE
Setting empty strings to NULL here is just a choice because I can't decide whether the user wants NULL or empty string with just an input field.
A specific use case would be very good where this scheme breaks. I could then think about how an UI supporting the difference between null and empty string could look like.

@planeth44
Copy link
Author

This makes sense.
My workaround is to make my custom MySQLDataFactory so I can add a ‘resetToBlank‘ function when calling ‘setValuesAndParameters’.
Is there a better way?

As for a suggestion, could you make it a parameter –blank is empty string– in the MySQLDataFactory just like the useUUIDs?

@philiplb
Copy link
Owner

philiplb commented Jul 3, 2018

Adding a flag to the field in the YAML is a good idea, I will do that.
Right after the release of 0.14.0 which abstracts out the framework and then there are packages for framework implementations, Silex and Symfony for now. Reason: Silex is end of live. :(

@philiplb philiplb added this to the 0.15.0 milestone Jul 3, 2018
@planeth44
Copy link
Author

👍
Looking forward to the release of 14.0. Any ETA?

@philiplb
Copy link
Owner

philiplb commented Jul 3, 2018

Mainly writing documentation is left. We are currently porting a bigger project to symfony4 and as soon as this works completly, I can be sure that the abstractions are fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants