Strange Doctrine of EntityNotFoundException

I ran into weird behavior with a Symfony and Doctrine issue that really discovered what might be related to this error.

request.CRITICAL: PHP exception from Doctrine \ ORM \ EntityNotFoundException: "Object not found" exception. in /dev/vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php 177 {"exception": "[object] (Doctrine \ ORM \ EntityNotFoundException (code: 0)

To provide some sample code:

$nextItems = $this->itemManager->findNextItemByCatId($catId, 2, $allItems); 

and then assign two returned results as follows:

 $output["next"] = $nextItems[0]; $output["following"] = $nextItems[1]; 

which are then actually returned via the API.

However, when for testing purposes I assign random values:

 $output["next"] = "Test value 1"; $output["following"] = "Test value 2"; 

then no exceptions and errors occur, and the response state is 200, as expected.

Any ideas here?

+3
php orm symfony doctrine2
Apr 28 '15 at 12:17
source share
2 answers

I struggled with this for several hours, after which I found two solutions:

  • apply doctrine workaround, line 758 BasicEntityPersister

change:

  return $entities ? $entities[0] : null; 

to:

  return $entities ? $entities[0] : $entity; 
  1. Restore symfony cache bootstrap:

     composer run-script post-update-cmd --no-dev 
    • for 2 I also upgraded mysql to 5.6
+3
Jul 27 '15 at 10:22
source share

Maybe, maybe, obviously, but are you checking to see if your queries return values? Make shure about your entity, no errors ( doctrine orm:validate-schema ).
And by the way, I have some problems with the proxy directory - normaly on OS X ( Doctrine 2. Proxy auto-generation )

+2
Apr 28 '15 at 12:53 on
source share



All Articles