Search code examples
phpsymfonydoctrine-ormdoctrine-query

getQuery (Doctrine) is running VERY VERY slow


I have setup a virtualbox running Linux Mint 16 x64 for R&D with Symfony2/Doctrine2. I installed Symfony via composer and it installed Doctrine with it. I setup this up about 2-3 weeks ago so the version I'm using should be latest or at least very recent.

The virtual machine is running Apache/MySQL and PHP of course. I only have 1 new database/schema in MySQL database and I have only created 1 new table. This new table only has less than 15 records so it shouldn't take that long to retrieve all the records.

When I run a code like below, I get the results very quickly.

var_dump($this->getDoctrine()->getEntityManager()->getRepository("my-class-here")->find(1);

But when I use query (see code below), the webpage often times out or Firefox just crashes.

var_dump($this->getDoctrine()->getEntityManager()->createQuery("SELECT s FROM my-class-here s");

Any ideas what could be happening and how to fix it?

thanks very much


Solution

  • try use:

    \Doctrine\Common\Util\Debug::dump($this->getDoctrine()->getEntityManager()->createQuery("SELECT s FROM my-class-here s"));