foreignKey() public method

Build foreign keys from primary keys array.
public foreignKey ( $primaryKey ) : array
$primaryKey An array where keys are primary keys and values are the associated values of primary keys.
return array An array where keys are foreign keys and values are the associated values of foreign keys.
Example #1
0
 public function testBelongsToForeignKey()
 {
     $config = array('from' => $this->_image, 'to' => $this->_gallery, 'type' => 'belongsTo', 'fieldName' => 'gallery');
     $relation = new Relationship($config + array('key' => 'gallery_id'));
     $expected = array('gallery_id' => 5);
     $this->assertEqual($expected, $relation->foreignKey(array('id' => 5)));
     $relation = new Relationship($config + array('key' => array('gallery_id' => 'id')));
     $this->assertEqual($expected, $relation->foreignKey(array('id' => 5)));
 }