Chapter: jDao: relational object mapping
« Zones | ^ Jelix components | Classic forms » |
jDAO is the Object Relational Mapping system of Jelix. It is to provide an easy way to create an object couple, record and factory, using the DAO pattern.
A record object represents a database record : its properties are mapped on the fields of one or more tables.
A factory object provides some methods allowing to create a record, to save it, to destroy it or to retrieve some sets of record objects.
A record and factory object couple is described in a XML file. jDAO then handles the generation of the corresponding PHP objects.
The XML file allows to avoid the tiresome writing of SQL requests, take care of SQL injections problems : the objects generated handle everything. The XML file can be generated by a development tool, like for example one of the scripts featured with Jelix.