-
Notifications
You must be signed in to change notification settings - Fork 1
Custom DAO's
A DAO is a data access object, a term popularized by the J2EE pattern. The UES DAO API is a convenience wrapper over common Moodle $DB
calls and provides developers a means to map classes to tables by class names, and the ability to make use of implicit meta data for those objects.
For the most simplistic extension:
- All tables must prefix with
enrol_
, because the data maybe directly associated with the Universal Enrollment Service. - The class name is singular in verbiage and plural as a table name, ie:
my_employee
maps toenrol_my_employees
. - If using meta information, a separate meta table with
meta
as the suffix in the table, ie:enrol_my_employeemeta
. Meta tables have the fields: id, name, value, parentid, where parent is the parent's class name, ie:my_employeeid
.
A DAO without meta information, can inherit from ues_external
, which provides all the DAO API without the extra save and remove call to meta tables.
A DAO with meta information, can inherit from ues_dao
, which provides all the DAO API, including implicit meta data retrieval.
All of the core DAO's have meta data capabilities. This means it is possible to store data about a semester, section, student, etc without having to modify the fields to the related tables. Should your data have similar requirements, then it is recommended to do the same.