unlink() public method
Destroys the relationship between two models.
The model with the foreign key of the relationship will be deleted if $delete
is true
. Otherwise, the foreign key will be set null
and the model will be saved without validation.
public void unlink ( $name, $model, $delete = false ) | ||
---|---|---|
$name | string |
The case sensitive name of the relationship, e.g. |
$model | yii\db\ActiveRecordInterface |
The model to be unlinked from the current one. You have to make sure that the model is really related with the current model as this method does not check this. |
$delete | boolean |
Whether to delete the model that contains the foreign key. If |
throws | yii\base\InvalidCallException |
if the models cannot be unlinked |
Please login to continue.