-
Notifications
You must be signed in to change notification settings - Fork 5
spawn behaviors
Generates a unique slug.
Advanced Sluggable configuration
// online_status default = 0
"Draftable": {
"default": "draft"
}
// online_status default = 1
"Draftable": {
"default": "online"
}
// online_status default = 1
"Draftable": {}
Custom Php behaviors can be spawned as well, as long as they have a relatively simple argument structure. Just configure them in the behaviors section of your Spawner model config, and provide them with the arguments that the Php behavior needs, if any. Json array arguments will be casted to numeric Php arrays, while Json objects will be casted to associative Php arrays.
You can also set the module property for a behavior, so that you can indicate whether the behavior belongs to the app or to Garp.
This spawns database columns author_id and modifier_id. The attached Authorable Php behavior will set these to the appropriate User records, after inserting and updating records through the Garp API.
This spawns database columns created and modified. The attached Timestampable Php behavior will set these to the appropriate datetime values, after inserting and updating records through the Garp API.
For fields of the html type, the HtmlFilterable Php behavior is automatically attached, so that filthy smudgy html is nuked before it could ever reach our precious database.
For fields that have the (default) required property, the NotEmpty Php behavior is automatically attached, so that illegal content is not allowed to be inserted into the database.
For fields of the email type, the Email Php behavior is automatically attached, so that only valid email addresses can be inserted into the database.