AtkOneToManyRelation: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== atkOneToManyRelation == | |||
function atkOneToManyRelation($name, $destination, $refKey="", $flags=0) | |||
* $name The unique name of this relation within a node ''- In contrast with moth other attributes, the name does not correspond to a database field. This is because in one2many relations, the databasefield that stores the link, is in the destination node (B) and not in the owner node (A)'' | |||
* $destination The node to which the relationship is made | |||
* $refKey For regular oneToMany relationships, $refKey is name of the referential key in the destination node. In the case of multi-foreign key relationships, $refKey can be an array of fields. | |||
'''Example''' | |||
Suppose a department (node A) has many employees (node B). To edit the list of employees in a department, this relationship can be built with an atkOneToManyRelation. Each employee gets a department_id (a_id). | |||
[[image:atkOneToMany.jpg|center]] | |||
Revision as of 10:00, 28 December 2006
atkOneToManyRelation
function atkOneToManyRelation($name, $destination, $refKey="", $flags=0)
- $name The unique name of this relation within a node - In contrast with moth other attributes, the name does not correspond to a database field. This is because in one2many relations, the databasefield that stores the link, is in the destination node (B) and not in the owner node (A)
- $destination The node to which the relationship is made
- $refKey For regular oneToMany relationships, $refKey is name of the referential key in the destination node. In the case of multi-foreign key relationships, $refKey can be an array of fields.
Example
Suppose a department (node A) has many employees (node B). To edit the list of employees in a department, this relationship can be built with an atkOneToManyRelation. Each employee gets a department_id (a_id).
