Adds a property to an entity along with all associated DTOs.
This command can add a new property onto an entity using just the CLI. No file required!
craftsman add:entity [options] <filepath>
Argument | Required | Type | Description |
---|---|---|---|
-e, --entity | Yes | Text | Name of the entity to add the property. Must match the name of the entity file (e.g. Vet.cs should be Vet ) |
-n, --name | Yes | Text | Name of the property to add |
-t, --type | Yes | Text | Data type of the property to add |
-f, --filter | No | Boolean | Determines if the property is filterable |
-s, --sort | No | Boolean | Determines if the property is sortable |
-k, --foreignkey | No | Text | When adding an object linked by a foreign key, use this field to enter the name of the property that acts as the foreign key |
Option | Description |
---|---|
-h, --help | Display help message. No filepath is needed to display the help message. |
craftsman add:property --entity Vet --name VetName --type string --filter false --sort true
craftsman add:property -e Vet -n VetName -t string -f false -s true
craftsman add:property -e Vet -n VetName -t string
craftsman add:property -e Sale -n Product -t Product -k ProductId
craftsman add:property -e Vet -n AppointmentDate -t DateTime? -f false -s true
Similar to when we're adding an entity with a foreign key in a file, we can add a foreign key property ad hoc using
the add:property
command. Let's say that we had a Sale
entity that has a ProductId
property that acts as a foreign key to another Product
entity. If
we wanted to return the product in our responses, we could add an additional Product
property of type Product
that links to the primary key of ProductId
in our Product
entity:
craftsman add:property -e Sale -n Product -t Product -k ProductId
Note that adding foreign keys will currently break the
Post
andUpdate
integration tests as described in issue #2.
👀 Docs Feedback
See something missing or light in content in the docs? Let me know! I want the Wrapt docs to be as through and helpful as possible!
If you'd like to request a new feature, you can submit a new Craftsman issue.