conceptover

Recent News

Where clause in doctrine zend framework

Doctrine is a layer that interact controller with database. It has its own functions for database interaction. Here is some code snippet that is used in controller to get countries on basis of some parameters. Where clause is used by doctrine.

$GetCountry = $this->getServiceLocator()->get(‘EntityManager’)->getRepository(‘AdministrationEntityCountry’)->find($mSession->country_id);
$QueryBuilder = $Repository->createQueryBuilder(‘S’)
->where(‘S.Country =:Country’)
->setParameter(‘Country’,$GetCountry)
->getQuery();

Leave a Reply

Your email address will not be published. Required fields are marked *