LoginSignup
8
6

More than 5 years have passed since last update.

Symfonyで最後に発行したSQLを確認する

Posted at

symfonyでquery builderを使ってコードを書いているときに発行したクエリが自分の想像しているものか確認するとき
良く忘れるので自分用にメモ

  $qb = $this->em->createQueryBuilder()
            ->select('hoge')
            ->from('Bundle\Entity\hoge', 'hoge')
            ->where('hoge.id = :id')
            ->setParameter('id', $id);
  $qb->getQuery()->getSQL();

これで結果をprintすれば発行したクエリがわかるので確認してクエリを修正する

8
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
6