I have two models related through a junction table. 

`$model->link()` is the method used to establish the relationship between the two models. It basically populates the junction table with the corresponding keys of both models.

If two models are linked and I try to link them again, there will be an error because the key pair already exists in the junction table. Then I'd need to check if this relation exists before attempting to link the models.

I think I could just create a model for the junction table and query for the proper record. The result of that query would tell if I need to perform the link.

The question is:

Is there a short and easy way to perform this check, using some yii built-in method?