Jignesh Rawal
Jignesh Rawal

Reputation: 549

Parameters not being replaced in Doctrine

I am unable to figure what is the problem here.

I have created the below query using doctrine Query Builder

$repo = $this->em->getRepository(self::STORE_TIMING);
$qb = $repo->createQueryBuilder('store_timings');
$qb->select('st')
   ->where('st.id = :identifier')
   ->setParameter('identifier', 100);

When i print the DQL :

print_r($qb->getDQL());die();

The query that is output is :

SELECT st FROM Test\BotBundle\Entity\StoreTimings store_timings WHERE st.id = :identifier

To my surprise the :identifier is not being replaced.

Request for some guidelines here.

Upvotes: 1

Views: 227

Answers (1)

Alessandro Minoccheri
Alessandro Minoccheri

Reputation: 35973

If you are using getDQL It doesn't return the query with parameter.

I advise you to use the _profiler to view the complete query with parameter

Upvotes: 2

Related Questions