Relation Betwenn 2 Database


I would like to make a relation betweenn 2 table in 2 differents database :

the principal is the database which contain t_tarifsvente

in the model Personne

  public function relations() {


        return array(


            'PersonnesActif' => array(self::MANY_MANY, 'TTarifsvente',


                'order' => 'nom'),




to have a connection with a second database, I put that code in the modelPersonne :

 public function getDbConnection() {

        return self::getPersonneDbConnection();





Try this extension - It has pretty good explanation of what need to be done in order to establish connection between 2 tables from different databases.