Symfony Exception

ORMException

HTTP 500 Internal Server Error

The identifier id is missing for a query of CatalogBundle\Entity\Product

Exception

Doctrine\ORM\ ORMException

  1.      *
  2.      * @return ORMException
  3.      */
  4.     public static function missingIdentifierField($className$fieldName)
  5.     {
  6.         return new self("The identifier $fieldName is missing for a query of " $className);
  7.     }
  8.     /**
  9.      * @param string $className
  10.      * @param string[] $fieldNames
ORMException::missingIdentifierField() in vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php (line 422)
  1.         $sortedId = [];
  2.         foreach ($class->identifier as $identifier) {
  3.             if ( ! isset($id[$identifier])) {
  4.                 throw ORMException::missingIdentifierField($class->name$identifier);
  5.             }
  6.             $sortedId[$identifier] = $id[$identifier];
  7.             unset($id[$identifier]);
  8.         }
EntityManager->find() in vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php (line 151)
  1.      *
  2.      * @return object|null The entity instance or NULL if the entity can not be found.
  3.      */
  4.     public function find($id$lockMode null$lockVersion null)
  5.     {
  6.         return $this->_em->find($this->_entityName$id$lockMode$lockVersion);
  7.     }
  8.     /**
  9.      * Finds all entities in the repository.
  10.      *
EntityRepository->find() in src/CatalogBundle/Controller/DefaultController.php (line 145)
  1.      */
  2.     public function getAttributesAjax(Request $request)
  3.     {
  4.         $em $this->getDoctrine()->getManager();
  5.         /** @var Product $product */
  6.         $product $em->getRepository('CatalogBundle:Product')->find($request->get('id'));
  7. //        die(VarDumper::dump($product));
  8.         $productAttributes $product->getProductAttributes();
  9.         $attributes = array();
  10.         $items = array();
  11.         if (!empty($productAttributes)) {
DefaultController->getAttributesAjax() in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle() in web/app.php (line 23)
  1. $request Request::createFromGlobals();
  2. Request::setTrustedProxies(
  3.     ['192.0.0.1''10.0.0.0/8'],
  4.     Request::HEADER_X_FORWARDED_ALL
  5. );
  6. $response $kernel->handle($request);
  7. $response->send();
  8. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

ORMException

Doctrine\ORM\ORMException:
The identifier id is missing for a query of CatalogBundle\Entity\Product

  at vendor/doctrine/orm/lib/Doctrine/ORM/ORMException.php:315
  at Doctrine\ORM\ORMException::missingIdentifierField()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:422)
  at Doctrine\ORM\EntityManager->find()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php:151)
  at Doctrine\ORM\EntityRepository->find()
     (src/CatalogBundle/Controller/DefaultController.php:145)
  at CatalogBundle\Controller\DefaultController->getAttributesAjax()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (web/app.php:23)