-
Notifications
You must be signed in to change notification settings - Fork 1
Biz.Model
-
Models are the data "holder" objects in BOP. Data is accessed via Collection.Attributes, but the data may be loaded from SQL (ORM), via an arbitrary data source (unusual), by an HTTP POST, or direct execution (calling a FormModel).
-
Most of the business logic ends up in models. Usually models will call other models, and rely on the ORM to do the work of generating the SQL. However, models sometimes call SQL.Connection (src) directly with an inline SELECT (DML is always generated).
-
Biz.FormModel: manages the workflow for HTTP forms; can be called directly so also used as "containers" for parameterized business logical involving the database.
-
Biz.ListModel: a sequence of rows, which is usually generated by an SELECT, but hooks exist (and are used) to generate rows from arbitrary data sources, e.g. DateTime::TimeZone->all_names.
-
Biz.PropertyModel: maps a single SQL table; performs CRUD on single rows or can be iterated with simple queries
-
ListFormModel: for modeling spreadsheet-like data entry. Like it's name suggests, hybrid of FormModel and ListModel. It's a FormModel that implements (most of) the ListModel interface. A ListFormModel has a distinct ListModel instance which provides the ListFormModel's primary keys.
internal_initialize()
describes the attributes of the model (like columns of a table)
declaratively uses BOP's extensive collection of types
execute.*()
gets called statically and passed an Agent.Request
puts the resulting instance of the model on the Agent.Request
other models can call with a hash_ref
-
SomeForm->execute($req, {...})
creates or updates records in the database -
SomeList->execute_load_all_with_query({...})
loads the model (filtered by given query)
load.*()
pulls data from the database
only loads data linked to the current auth_realm on the Agent.Request
dies if the data is not found
unsafe_load.*()
almost same as load
it doesn't die if data is not found
instead of returning the loaded object, it returns true or false
unauth_load.*()
intentionally longer name
if you type unauth, you should be thinking carefully about security
- Agenda
- Getting Started
- My-Status Example Application
- Model
- View
- Task
- Application Support
- Testing
- Miscellaneous