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

Move make:entity reserved validation until later & skip for relations #473

Open
weaverryan opened this issue Sep 23, 2019 · 1 comment
Open

Comments

@weaverryan
Copy link
Member

When you use make:entity, we validate property names against the reserved keyword list. If a property name is a keyword, we fail validation and don't allow this. On some systems, this (for example) doesn't allow you to create a user property, which is kind of convenient :).

And... if this is a relation property, it really shouldn't go through this validation, and a user property would become a user_id column - and the addition of the id part will probably mean that this will never be a reserved word.

To fix this, we would need to move the validation until later when we know the "type" of the field. Then, if the field does fail validation, we can ask the user for a different "column" name - e.g. they might have a group field name, but call it a group_name column.

@johnpancoast
Copy link

johnpancoast commented Dec 29, 2019

Was just going to write the same thing about the resultant user_id column not being reserved. I usually just name user something else to get by (really love the rest of make:entity features) and then I rename it after, but would be great to have the check later like you said.

Another solution that was mentioned in #485 would be to allow the name values for tables and columns to be specified, i.e., the name values for @ORM\Table(), @ORM\Column(), and @ORM\JoinColumn() annotations.

weaverryan added a commit that referenced this issue Apr 3, 2020
This PR was squashed before being merged into the 1.0-dev branch (closes #545).

Discussion
----------

Make User: availability to chose table's name

Hello,

this fixes #485

i may provide a fix for #473 in another PR

Commits
-------

4b42eca check table name using  naming strategy
966c355 MakeUser: availability to chose table's name
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