Jump to content

ATK Relations: Difference between revisions

From NusaATK
No edit summary
 
No edit summary
Line 8: Line 8:
* $refKey: foreign-key field (master mode) or empty (slave mode)
* $refKey: foreign-key field (master mode) or empty (slave mode)


== Master mode ==
== Master mode example ==
The current node is considered the master, and the referential key pointing to the master record is in the destination node.
The node in which the relation is implemented, is considered the master (code is in node A). And the referential key pointing to the master record (a_id) is in the destination node (node B).
 
'''Example'''
 
One to One relation in node A to node B. Referential key is in the other node, so this is the master-configuration:


[[image:atkOneToOne_master.jpg]]


Referential key a_id is in the other node, so this is the master-configuration.


== Slave mode ==
The node in which the relation is implemented (code is in node B), is considered the child. And the referential key pointing to the master record (a_id) is in the current node (node B).


== Slave mode ==
[[image:atkOneToOne_slave.jpg]]
The current node is considered the child, and the referential key pointing to the master record is in the current node.


Referential key a_id is in the same node, so this is the slave-configuration.


= atkOneToManyRelation =
= atkOneToManyRelation =


= atkManyToOneRelation =
= atkManyToOneRelation =

Revision as of 12:15, 14 July 2006

atkOneToOneRelation

The atkOneToOneRelation supports two configurations: master mode and slave mode. The mode to use is detected automatically based on the value of the $refKey parameter.

function atkOneToOneRelation($name, $destination, $refKey="", $flags=0)
  • $name: The unique name of the attribute.
  • $destination: the destination node (in module.nodename notation)
  • $refKey: foreign-key field (master mode) or empty (slave mode)

Master mode example

The node in which the relation is implemented, is considered the master (code is in node A). And the referential key pointing to the master record (a_id) is in the destination node (node B).

Referential key a_id is in the other node, so this is the master-configuration.

Slave mode

The node in which the relation is implemented (code is in node B), is considered the child. And the referential key pointing to the master record (a_id) is in the current node (node B).

Referential key a_id is in the same node, so this is the slave-configuration.

atkOneToManyRelation

atkManyToOneRelation