Server-side programming often requires dealing with databases, and CRUD is the basic operation. The data object is the center of the entire operation, a record of the database corresponds to the information of a data object, and ORM (Object Relational mapping) is about how to gracefully combine data objects with crud. This is the main implementation of a common ORM module. First look at the system diagram:
There is a mapper in the middle of a database record-to-object transformation, where the mapper executes instructions on the database and an abstraction of an interface for application use. All the data objects here inherit from the object class, which is the principle of everything. For example, now to do a school information management system. There may be several object information stored in the database. Their relationship can be expressed as follows:
A simple inheritance diagram. There is another set of inheritance relationships that, when finding multiple object data, requires several lists to easily traverse the object information:
Also very simple, the specific interface diagram is not given. For example, build the factory class for the object. Build the assembler for the query criteria, and so on. Specifically, this information management system ORM based on MONGODB implementation can be seen.
end~
Basic implementation of ORM under PHP