Basic implementation of ORM under PHP

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.