Open omgslinux opened 2 years ago
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
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 code>@ORM\Entity</code 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.