Skip to content

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

Open
@weaverryan

Description

@weaverryan
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.

Activity

johnpancoast

johnpancoast commented on Dec 29, 2019

@johnpancoast

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.

added a commit that references this issue on Apr 3, 2020

bug #545 Make User: availability to chose table's name (nikophil)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @johnpancoast@weaverryan

        Issue actions

          Move make:entity reserved validation until later & skip for relations · Issue #473 · symfony/maker-bundle