Relation Correlation Model

Source: Internet
Author: User

An association relationship must have a reference table, for example:
There is an employee file management system project that includes the following data sheets: Basic information sheets, employee profiles, departmental tables, project group tables, bank card forms (used to record employee card information).
There is a certain correlation between these data tables, and we analyze the association between the other tables as a reference to the Employee Basic information table:
Each employee must have corresponding employee file information, so belong to Has_one association;
Each employee must belong to a department, so it belongs to Belongs_to Association;
Each employee can have multiple bank cards, but each card may belong to only one employee and therefore belong to the Has_many association;
Each employee can be in multiple project groups at the same time, each project group has multiple employees at the same time and therefore belongs to Many_to_many Association;
After analyzing the relationship between the data tables, we can make association definitions and associated operations.

Http://doc.thinkphp.cn/manual/relation_model.html

Main Table

This table uses the ID of the master's member.

The card table also has member ID

Grammatical composition

Relation Correlation Model

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.