Summary today:
Associate Model
ONE_TO_ONE: HAS_ONE & BELONGS_TO
ONE_TO_MANY: HAS_MANY & BELONGS_TO
MANY_TO_MANY
First, define the model class headed by the table name on the model end to integrate the associated model class.
Define the protection variable $ _ link = array () in the class, which is the field ing method;
For example, if the user table is mapped to archive as the hasone ing method, or one-to-one, belonsto can also be used.
Dept is the belonsto ing method.
Grp is the manytomany ing mode.
The default manytomany mode indicates the name of the target table.
You can also set the value of relation_table for initialization.
Set the relation () parameter of the hasone instantiated object to the true value and call the method of object link ing for addition, deletion, modification, and query.
After the associated model object is added, deleted, modified, and queried, the associated unique fields will change.
Auto Fill ~ Complete unlimited Classification
In the activity section, the instantiated object calls the field method parameter, including the concat method parameter, including the path connector-id as bpath, and calls the coherent operation. The order method parameter is bpath, And the select method of object link ing is used. Foreache traverses the data obtained above and adds a new field count to each of them to assign the value to the count method parameter as the explode method parameter as the connector-bpath field, in this way, each record is added with a count field equal to the length of its own path. Then, the assign Method under ¥ this is called for value assignment and the display method is called for display.
The view side calls the volist label for the add activity for the form submission direction. The option label value is {$ vo ['id']}. Use the php label in the volist label for a for loop and output spaces. output name value externally in php labels
Set the Automatic completion value on the custom model end to array. Set the path field to the tclm filling column of the callback function, and define the tclm function to set the pid to 0 if the passed pid does not exist, if the value is 0, 0 is returned. If the query id is set to pid, the returned data is the path connection of the parent entry-the id of the connection parent entry.