Objects
From Project Auriga
Contents |
[edit] Timer
Timer object: start, assign to task, stop, park
[edit] Time Entry
Time_entry object: create, assign to date, adjust time, delete, confirm, approve, pay, bill, edit note
[edit] Project
Project object: create, set type, get report, add task, apply template
[edit] Task
Task object: create, adjust estimated time, schedule all, schedule set amount, set type, complete
[edit] Account
[edit] Data Plugins
Data plugins are used to synchronize with foreign databases. We started with plugins for SugarCRM and SQL-Ledger/LedgerSMB.
[edit] Data Manager
The fl_db class manages all data plugins, the registry, and the map. This is a singleton object, and you generally start by getting a reference to it using:
$obj = fl_db::get_obj();
With a reference, a class in the model can have a consistent API to interact with a foreign data source. It can get a reference to a data plugin with:
$plugin = $obj->get_plugin('name');
It has some other static methods to retrieve a database handle (which only makes a connection when it's first called):
$db = fl_db::get_dbh('finance');
The config.php file should register all of the data plugins with the fl_db class, passing a connection string. It should also register authorization and authentication plugins:
$obj->register('name','plugin_class','connectionstring','API_URL');
$obj->register_authn('name',array(auth_table, user,pw));
$obj->register_authz('name','module');
Finally, the fl_db object handles mapping objects between the native database and the foreign database. At this point, only "account" types are mapped--we need to develop a more generic way of handling this mapping. Two methods are provided--one for converting to a foreign key, the other for retrieving the native key.
To retrieve a foreign key:
$key = $obj->map(object_type,$object, plugin_name, type);
... the object_type can only be 'account' right now, but may be expanded to 'contact' or 'project' or others. $object needs to implement a get_id() method and a get_map_col() method. plugin_name refers to one of the standard plugins to be registered: finance, native, or sales. type is used for plugins that represent multiple objects, right now only finance (customer or vendor).
See data plugins for more.

