Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

phql, where statement in joined table

hi all, how can i make where statement in phql query builder for field in joined table my phalcon configuration is using module and namespace

sample 2 tabel

  • tabel user -- field userid -- fied user -- field roleid

  • tabel role -- field role_id -- field role

i want select from user join with role where role="operator"

tanks before

edited Oct '14

i make it work

        $builder = $this->modelsManager->createBuilder();
        $builder->join('Sistem\Model\CrPeran', 'p.peran_id = u.peran_id','p');
        $builder->where('p.peran = :slopok: or p.peran = :wader:',array('slopok'=>'Operator','wader'=>'Administrator'));
        $builder->andWhere('user_aktif = :x:', array('x' => 0));

        $user = $builder->getQuery()->execute();
        foreach ($user as $x) {
            echo $x->user." ".$x->CrPeran->peran."<br>";