I am Working with Doctrine 2.3 I am facing difficulty to design a Query for the below scenario.
SELECT * FROM source WHERE source_id ='10' or source_id ='100' or source_id ='30'
I did this for single Id selection but I am not sure how to do this.
$qry = $this->manager()->create()
->select('e')
->from($this->entity, 'e')
->where('e.id = :id');
Can some one help me in this? If I get to know the working for the above query I will solve my other issues.. As Follows.
SELECT * FROM source WHERE source_id ='10' and source_name ='test' and source_val ='30'
For first one change your where clause like,
->where('e.id IN (:ids)')
->setParameter('ids', $ids)
Where $ids = array('10','100','');
And to use and condition for your second query it should be something like,
$qry = $this->manager()->create()
->select('e')
->from($this->entity, 'e')
->where('e.source_id = :id')
->andWhere('source_name=?', 'test')
->andWhere('source_val=?', '30')