db\ActiveRecordInterface link()

link() public abstract method

Establishes the relationship between two records.

The relationship is established by setting the foreign key value(s) in one record to be the corresponding primary key value(s) in the other record. The record with the foreign key will be saved into database without performing validation.

If the relationship involves a junction table, a new row will be inserted into the junction table which contains the primary key values from both records.

This method requires that the primary key value is not null.

public abstract void link ( $name, $model, $extraColumns = [] )
$name string

The case sensitive name of the relationship, e.g. orders for a relation defined via getOrders() method.

$model static

The record to be linked with the current one.

$extraColumns array

Additional column values to be saved into the junction table. This parameter is only meaningful for a relationship involving a junction table (i.e., a relation set with yii\db\ActiveQueryInterface::via()).

doc_Yii
2016-10-30 16:56:28
Comments
Leave a Comment

Please login to continue.