MongoDB few collection in one Model

Hi, how i can use 2 collections in one Model. e.g.

class Admin extends Collection{
    public function getSource(){
        return "user1"
    }
    public static function findUser1(){
        $user1 = new Admin();
        $user1->setSource("user1");
        $cursor = $users1->find()
        foreach($cursor as $doc){
            echo $doc['login']
        }
    }
    public static function findUser2(){
        $user2 = new Admin();
        $user2->setSource("user2");
        $cursor = $users2->find()
        foreach($cursor as $doc){
            echo $doc['login']
        }
    }
}

But, will work only findUser1.

setSource work only with insert operation, where i mistake ?



37.9k

Hey What is code working findUser1



5.7k
edited Oct '14

Yes, findUser1 works. findUser2 don't works (i.e work with collection "user1").

findUser2 must works with user2.
But only "insert" operation works(with collection user2),
and "find" works with collection user1.

But must works with collection user2.

Does not work both examples.

It will be a limitation of Phalcon?