how do i write not equal to in a doctrine where clause?
doctrine-orm, zend-framework
Solution
Francesco's answer is correct. It all depends on your will to use either the expression builder or a high level solution.
For your particular case you can choose one of the two.
Expression builder:
$queryBuilder = $this->_em->createQueryBuilder();
$expr = $queryBuilder->expr();
$query = $queryBuilder
->select('a')
->from('entity', 'a')
->where($expr->neq('a.deleted', 1))
->getQuery();
For high level solution see Rawkode's answer. Except changing the `!=` to `<>` or using `a.deleted = 0`.
Better yet would be parametrizing this with Doctrine
->where('a.deleted = :deleted')
->setParameter('deleted', false);
Problem
I hope someone can help me, i'm writing a custom query in my repository and i'd like to do the below:- ``` $query = $this->_em->createQueryBuilder() ->select('a') ->from('entity', 'a') ->where('a.deleted not 1') /// how do you write NOT??? i've tried <> etc ->getQuery(); ``` How do i perform the above? Thanks Andrew