Name | Type | Required | Default | Hint |
name | string | true | Name of the model to create without the .cfc. For packages, specify name as 'myPackage/myModel' | |
methods | string | false | A comma-delimited list of method stubs to generate for you | |
persistence | string | false | transient | Specify singleton to have only one instance of this model created |
tests | boolean | false | true | Generate the unit test BDD component |
testsDirectory | string | false | tests/specs/unit | Your unit tests directory. Only used if tests is true |
directory | string | false | models | The base directory to create your model in and creates the directory if it does not exist. |
script | boolean | false | true | Generate content in script markup or tag markup |
description | string | false | I am a new Model Object | The model hint description |
open | boolean | false | false | Open the file once generated |
accessors | boolean | false | true | Setup accessors to be true or not in the component |
properties | string | false | Enter a list of properties to generate. You can add the type via semicolon separator. Ex: firstName,age:numeric,wheels:array |
Create a new model CFC in an existing ColdBox application. Make sure you are running this command in the root
of your app for it to find the correct folder. You can optionally create unit tests for your new model at the same time.
By default, your new model will be created in /model but you can override that with the directory param.
Once you create a model you can add a mapping for it in your WireBox binder, or use ColdBox's default scan location and
just reference it with getModel( 'modelName' ).
coldbox create model myModel --open
coldbox create model name=User properties=fname,lname,email --accessors --open