maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

Allow make:entity ask for unique fields or assertions

Open omgslinux opened this issue 3 years ago • 1 comments

I miss the generator to prevent from "forgetting" to have the "skeleton" and basic constraints for unique keys, via both assertion and bbdd unique key(s). The desired result would be to have a kind of basic declaration of both at the top of the class declaration, near the @ORM\Entity annotation, so they can be easily adjusted later.

I'm not sure how to accomplish this. I think that when creating an entity, it would be nice to be prompted something like 'Does this entity have unique keys?', and if yes, generate the mentioned code. Also, for each field, ask or at least try to guess a basic assertion (for example, NotNull after answering the question about if the field can be null in the database), using a similar philosophy when trying to guess the field type in form classes when the field type class is null.

omgslinux avatar Sep 11 '22 00:09 omgslinux

I'm not sure about the unique part... I don't know if it's a common enough thing to always be asking.

But it IS an interesting idea to automatically guess/give validation constraints to properties (if the validator is installed). That's a good idea

weaverryan avatar Sep 22 '22 13:09 weaverryan