Hi:

    public function findCompanyWithoutDocument() {
        $q2 = $this->createQueryBuilder('c2')
                ->select('c2.company')
                ->from('RegisterCompanyBundle:CompanyHasMedia', 'c2');

        $query = $this->createQueryBuilder('c')
                ->from('RegisterCompanyBundle:Company', 'c')
                ->where($query->expr()->notIn('c.id', $q2->getSQL()
        ));

        echo $query->getQuery()->getSQL();
    }

In this case, error is in your where sentence. It is because $query is not 
defined yet.

try this;

    public function findCompanyWithoutDocument() {
        $q2 = $this->createQueryBuilder('c2')
                ->select('c2.company')
                ->from('RegisterCompanyBundle:CompanyHasMedia', 'c2');

*        $query = $this->createQueryBuilder('c');*
         //now $query is defined.. :)
        $query->from('RegisterCompanyBundle:Company', 'c')
                ->where($query->expr()->notIn('c.id', $q2->getSQL()
        ));

        echo $query->getQuery()->getSQL();
    }

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to