Symfony Exception

PDOException Exception ConnectionException

HTTP 500 Internal Server Error

An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

Exceptions 3

Doctrine\DBAL\Exception\ ConnectionException

  1.             case '1227':
  2.             case '1370':
  3.             case '1429':
  4.             case '2002':
  5.             case '2005':
  6.                 return new ConnectionException($message$exception);
  7.             case '2006':
  8.                 return new ConnectionLost($message$exception);
  9.             case '1048':
  1.         if ($driverEx instanceof DriverException) {
  2.             return $driverEx;
  3.         }
  4.         if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DeprecatedDriverException) {
  5.             return $driver->convertException($msg$driverEx);
  6.         }
  7.         return new Exception($msg0$driverEx);
  8.     }
  1.      *
  2.      * @return Exception
  3.      */
  4.     public static function driverException(Driver $driverThrowable $driverEx)
  5.     {
  6.         return static::wrapException($driver$driverEx'An exception occurred in driver: ' $driverEx->getMessage());
  7.     }
  8.     /**
  9.      * @return Exception
  10.      */
  1.                 $username,
  2.                 $password,
  3.                 $driverOptions
  4.             );
  5.         } catch (PDOException $e) {
  6.             throw Exception::driverException($this$e);
  7.         }
  8.         return $conn;
  9.     }
  1.         $driverOptions $this->params['driverOptions'] ?? [];
  2.         $user          $this->params['user'] ?? null;
  3.         $password      $this->params['password'] ?? null;
  4.         $this->_conn $this->_driver->connect($this->params$user$password$driverOptions);
  5.         $this->transactionNestingLevel 0;
  6.         if ($this->autoCommit === false) {
  7.             $this->beginTransaction();
  1.         }
  2.         // If not connected, we need to connect now to determine the platform version.
  3.         if ($this->_conn === null) {
  4.             try {
  5.                 $this->connect();
  6.             } catch (Throwable $originalException) {
  7.                 if (empty($this->params['dbname'])) {
  8.                     throw $originalException;
  9.                 }
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> getDatabasePlatformVersion (line 387)
  1.      *
  2.      * @throws Exception If an invalid platform was specified for this connection.
  3.      */
  4.     private function detectDatabasePlatform(): void
  5.     {
  6.         $version $this->getDatabasePlatformVersion();
  7.         if ($version !== null) {
  8.             assert($this->_driver instanceof VersionAwarePlatformDriver);
  9.             $this->platform $this->_driver->createDatabasePlatformForVersion($version);
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> detectDatabasePlatform (line 330)
  1.      * @throws Exception
  2.      */
  3.     public function getDatabasePlatform()
  4.     {
  5.         if ($this->platform === null) {
  6.             $this->detectDatabasePlatform();
  7.         }
  8.         return $this->platform;
  9.     }
  1.      * @return Platforms\AbstractPlatform
  2.      */
  3.     private function getTargetPlatform()
  4.     {
  5.         if (!$this->targetPlatform) {
  6.             $this->targetPlatform $this->em->getConnection()->getDatabasePlatform();
  7.         }
  8.         return $this->targetPlatform;
  9.     }
  10. }
  1.      */
  2.     private function completeIdGeneratorMapping(ClassMetadataInfo $class)
  3.     {
  4.         $idGenType $class->generatorType;
  5.         if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
  6.             if ($this->getTargetPlatform()->prefersSequences()) {
  7.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
  8.             } else if ($this->getTargetPlatform()->prefersIdentityColumns()) {
  9.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
  10.             } else {
  11.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
  1.         // However this is only true if the hierarchy of parents contains the root entity,
  2.         // if it consists of mapped superclasses these don't necessarily include the id field.
  3.         if ($parent && $rootEntityFound) {
  4.             $this->inheritIdGeneratorMapping($class$parent);
  5.         } else {
  6.             $this->completeIdGeneratorMapping($class);
  7.         }
  8.         if (!$class->isMappedSuperclass) {
  9.             foreach ($class->embeddedClasses as $property => $embeddableClass) {
  1.             }
  2.             $class $this->newClassMetadataInstance($className);
  3.             $this->initializeReflection($class$reflService);
  4.             $this->doLoadMetadata($class$parent$rootEntityFound$visited);
  5.             $this->loadedMetadata[$className] = $class;
  6.             $parent $class;
  1.     /**
  2.      * {@inheritDoc}
  3.      */
  4.     protected function loadMetadata($name)
  5.     {
  6.         $loaded parent::loadMetadata($name);
  7.         array_map([$this'resolveDiscriminatorValue'], array_map([$this'getMetadataFor'], $loaded));
  8.         return $loaded;
  9.     }
  1.                 if ($cached instanceof ClassMetadata) {
  2.                     $this->loadedMetadata[$realClassName] = $cached;
  3.                     $this->wakeupReflection($cached$this->getReflectionService());
  4.                 } else {
  5.                     foreach ($this->loadMetadata($realClassName) as $loadedClassName) {
  6.                         $this->cacheDriver->save(
  7.                             $loadedClassName $this->cacheSalt,
  8.                             $this->loadedMetadata[$loadedClassName]
  9.                         );
  10.                     }
  1.      *
  2.      * @return \Doctrine\ORM\Mapping\ClassMetadata
  3.      */
  4.     public function getClassMetadata($className)
  5.     {
  6.         return $this->metadataFactory->getMetadataFor($className);
  7.     }
  8.     /**
  9.      * {@inheritDoc}
  10.      */
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function getRepository(EntityManagerInterface $entityManager$entityName): ObjectRepository
  5.     {
  6.         $metadata            $entityManager->getClassMetadata($entityName);
  7.         $repositoryServiceId $metadata->customRepositoryClassName;
  8.         $customRepositoryName $metadata->customRepositoryClassName;
  9.         if ($customRepositoryName !== null) {
  10.             // fetch from the container
  1.      *
  2.      * @return ObjectRepository|EntityRepository The repository class.
  3.      */
  4.     public function getRepository($entityName)
  5.     {
  6.         return $this->repositoryFactory->getRepository($this$entityName);
  7.     }
  8.     /**
  9.      * Determines whether an entity instance is managed in this EntityManager.
  10.      *
  1.      */
  2.     public function getRepository($persistentObjectName$persistentManagerName null)
  3.     {
  4.         return $this
  5.             ->selectManager($persistentObjectName$persistentManagerName)
  6.             ->getRepository($persistentObjectName);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      */
AbstractManagerRegistry->getRepository() in src/AgriVector/Service/Market/SellingOfferService.php (line 49)
  1.     /**
  2.      * @return SellingOfferRepository|ObjectRepository
  3.      */
  4.     protected function getRepository()
  5.     {
  6.         return $this->getManager()->getRepository(SellingOffer::class);
  7.     }
  8.     public function save(SellingOffer $sellingOffer)
  9.     {
  10.         $this->saveUploadedImages($sellingOffer);
SellingOfferService->getRepository() in src/AgriVector/Service/BaseService.php (line 29)
  1.      * @param array $orderBy
  2.      * @return ArrayCollection
  3.      */
  4.     public function findBy(array $criteria = [], array $orderBy null$limit null$offset null)
  5.     {
  6.         $itemList $this->getRepository()->findBy($criteria$orderBy$limit$offset);
  7.         return new ArrayCollection($itemList);
  8.     }
  9.     public function findOneBy(array $criteria = [], array $orderBy null)
  1.     public function getSellingOffersByTarget($target)
  2.     {
  3.         $sellingOffers = new ArrayCollection();
  4.         if (is_null($target) ||  $target != HomeController::TARGET_BUYER) {
  5.             $target HomeController::TARGET_FARMER;
  6.             $sellingOffers $this->findBy(['status' => true],[],3);
  7.         }
  8.         if ($target === HomeController::TARGET_BUYER) {
  9.             $sellingOffers $this->findBy(['status' => true],[],4);
  10.         }
  11.         return $sellingOffers;
SellingOfferService->getSellingOffersByTarget() in src/AgriVector/Controller/HomeController.php (line 47)
  1.      * @return Response
  2.      */
  3.     public function homeAction(SellingOfferService  $sellingOfferService$target self::TARGET_FARMER)
  4.     {
  5.         return $this->render('homepage/homepage.html.twig', [
  6.             'sellingOffers' => $sellingOfferService->getSellingOffersByTarget($target),
  7.             'target' => $target
  8.         ]);
  9.     }
  10.     /**
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $requestint $type HttpKernelInterface::MASTER_REQUESTbool $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 public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Doctrine\DBAL\Driver\PDO\ Exception

SQLSTATE[HY000] [2002] Connection refused

  1.  */
  2. final class Exception extends PDOException
  3. {
  4.     public static function new(\PDOException $exception): self
  5.     {
  6.         return new self($exception);
  7.     }
  8. }
  1.         try {
  2.             parent::__construct($dsn, (string) $user, (string) $password, (array) $options);
  3.             $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
  4.             $this->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
  5.         } catch (PDOException $exception) {
  6.             throw Exception::new($exception);
  7.         }
  8.     }
  9.     /**
  10.      * {@inheritdoc}
  1.      */
  2.     public function connect(array $params$username null$password null, array $driverOptions = [])
  3.     {
  4.         try {
  5.             $conn = new PDO\Connection(
  6.                 $this->constructPdoDsn($params),
  7.                 $username,
  8.                 $password,
  9.                 $driverOptions
  10.             );
  11.         } catch (PDOException $e) {
  1.         $driverOptions $this->params['driverOptions'] ?? [];
  2.         $user          $this->params['user'] ?? null;
  3.         $password      $this->params['password'] ?? null;
  4.         $this->_conn $this->_driver->connect($this->params$user$password$driverOptions);
  5.         $this->transactionNestingLevel 0;
  6.         if ($this->autoCommit === false) {
  7.             $this->beginTransaction();
  1.         }
  2.         // If not connected, we need to connect now to determine the platform version.
  3.         if ($this->_conn === null) {
  4.             try {
  5.                 $this->connect();
  6.             } catch (Throwable $originalException) {
  7.                 if (empty($this->params['dbname'])) {
  8.                     throw $originalException;
  9.                 }
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> getDatabasePlatformVersion (line 387)
  1.      *
  2.      * @throws Exception If an invalid platform was specified for this connection.
  3.      */
  4.     private function detectDatabasePlatform(): void
  5.     {
  6.         $version $this->getDatabasePlatformVersion();
  7.         if ($version !== null) {
  8.             assert($this->_driver instanceof VersionAwarePlatformDriver);
  9.             $this->platform $this->_driver->createDatabasePlatformForVersion($version);
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> detectDatabasePlatform (line 330)
  1.      * @throws Exception
  2.      */
  3.     public function getDatabasePlatform()
  4.     {
  5.         if ($this->platform === null) {
  6.             $this->detectDatabasePlatform();
  7.         }
  8.         return $this->platform;
  9.     }
  1.      * @return Platforms\AbstractPlatform
  2.      */
  3.     private function getTargetPlatform()
  4.     {
  5.         if (!$this->targetPlatform) {
  6.             $this->targetPlatform $this->em->getConnection()->getDatabasePlatform();
  7.         }
  8.         return $this->targetPlatform;
  9.     }
  10. }
  1.      */
  2.     private function completeIdGeneratorMapping(ClassMetadataInfo $class)
  3.     {
  4.         $idGenType $class->generatorType;
  5.         if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
  6.             if ($this->getTargetPlatform()->prefersSequences()) {
  7.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
  8.             } else if ($this->getTargetPlatform()->prefersIdentityColumns()) {
  9.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
  10.             } else {
  11.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
  1.         // However this is only true if the hierarchy of parents contains the root entity,
  2.         // if it consists of mapped superclasses these don't necessarily include the id field.
  3.         if ($parent && $rootEntityFound) {
  4.             $this->inheritIdGeneratorMapping($class$parent);
  5.         } else {
  6.             $this->completeIdGeneratorMapping($class);
  7.         }
  8.         if (!$class->isMappedSuperclass) {
  9.             foreach ($class->embeddedClasses as $property => $embeddableClass) {
  1.             }
  2.             $class $this->newClassMetadataInstance($className);
  3.             $this->initializeReflection($class$reflService);
  4.             $this->doLoadMetadata($class$parent$rootEntityFound$visited);
  5.             $this->loadedMetadata[$className] = $class;
  6.             $parent $class;
  1.     /**
  2.      * {@inheritDoc}
  3.      */
  4.     protected function loadMetadata($name)
  5.     {
  6.         $loaded parent::loadMetadata($name);
  7.         array_map([$this'resolveDiscriminatorValue'], array_map([$this'getMetadataFor'], $loaded));
  8.         return $loaded;
  9.     }
  1.                 if ($cached instanceof ClassMetadata) {
  2.                     $this->loadedMetadata[$realClassName] = $cached;
  3.                     $this->wakeupReflection($cached$this->getReflectionService());
  4.                 } else {
  5.                     foreach ($this->loadMetadata($realClassName) as $loadedClassName) {
  6.                         $this->cacheDriver->save(
  7.                             $loadedClassName $this->cacheSalt,
  8.                             $this->loadedMetadata[$loadedClassName]
  9.                         );
  10.                     }
  1.      *
  2.      * @return \Doctrine\ORM\Mapping\ClassMetadata
  3.      */
  4.     public function getClassMetadata($className)
  5.     {
  6.         return $this->metadataFactory->getMetadataFor($className);
  7.     }
  8.     /**
  9.      * {@inheritDoc}
  10.      */
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function getRepository(EntityManagerInterface $entityManager$entityName): ObjectRepository
  5.     {
  6.         $metadata            $entityManager->getClassMetadata($entityName);
  7.         $repositoryServiceId $metadata->customRepositoryClassName;
  8.         $customRepositoryName $metadata->customRepositoryClassName;
  9.         if ($customRepositoryName !== null) {
  10.             // fetch from the container
  1.      *
  2.      * @return ObjectRepository|EntityRepository The repository class.
  3.      */
  4.     public function getRepository($entityName)
  5.     {
  6.         return $this->repositoryFactory->getRepository($this$entityName);
  7.     }
  8.     /**
  9.      * Determines whether an entity instance is managed in this EntityManager.
  10.      *
  1.      */
  2.     public function getRepository($persistentObjectName$persistentManagerName null)
  3.     {
  4.         return $this
  5.             ->selectManager($persistentObjectName$persistentManagerName)
  6.             ->getRepository($persistentObjectName);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      */
AbstractManagerRegistry->getRepository() in src/AgriVector/Service/Market/SellingOfferService.php (line 49)
  1.     /**
  2.      * @return SellingOfferRepository|ObjectRepository
  3.      */
  4.     protected function getRepository()
  5.     {
  6.         return $this->getManager()->getRepository(SellingOffer::class);
  7.     }
  8.     public function save(SellingOffer $sellingOffer)
  9.     {
  10.         $this->saveUploadedImages($sellingOffer);
SellingOfferService->getRepository() in src/AgriVector/Service/BaseService.php (line 29)
  1.      * @param array $orderBy
  2.      * @return ArrayCollection
  3.      */
  4.     public function findBy(array $criteria = [], array $orderBy null$limit null$offset null)
  5.     {
  6.         $itemList $this->getRepository()->findBy($criteria$orderBy$limit$offset);
  7.         return new ArrayCollection($itemList);
  8.     }
  9.     public function findOneBy(array $criteria = [], array $orderBy null)
  1.     public function getSellingOffersByTarget($target)
  2.     {
  3.         $sellingOffers = new ArrayCollection();
  4.         if (is_null($target) ||  $target != HomeController::TARGET_BUYER) {
  5.             $target HomeController::TARGET_FARMER;
  6.             $sellingOffers $this->findBy(['status' => true],[],3);
  7.         }
  8.         if ($target === HomeController::TARGET_BUYER) {
  9.             $sellingOffers $this->findBy(['status' => true],[],4);
  10.         }
  11.         return $sellingOffers;
SellingOfferService->getSellingOffersByTarget() in src/AgriVector/Controller/HomeController.php (line 47)
  1.      * @return Response
  2.      */
  3.     public function homeAction(SellingOfferService  $sellingOfferService$target self::TARGET_FARMER)
  4.     {
  5.         return $this->render('homepage/homepage.html.twig', [
  6.             'sellingOffers' => $sellingOfferService->getSellingOffersByTarget($target),
  7.             'target' => $target
  8.         ]);
  9.     }
  10.     /**
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $requestint $type HttpKernelInterface::MASTER_REQUESTbool $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 public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

PDOException

SQLSTATE[HY000] [2002] Connection refused

  1.      * @throws PDOException In case of an error.
  2.      */
  3.     public function __construct($dsn$user null$password null, ?array $options null)
  4.     {
  5.         try {
  6.             parent::__construct($dsn, (string) $user, (string) $password, (array) $options);
  7.             $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
  8.             $this->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
  9.         } catch (PDOException $exception) {
  10.             throw Exception::new($exception);
  11.         }
  1.      * @throws PDOException In case of an error.
  2.      */
  3.     public function __construct($dsn$user null$password null, ?array $options null)
  4.     {
  5.         try {
  6.             parent::__construct($dsn, (string) $user, (string) $password, (array) $options);
  7.             $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, [Statement::class, []]);
  8.             $this->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
  9.         } catch (PDOException $exception) {
  10.             throw Exception::new($exception);
  11.         }
  1.      */
  2.     public function connect(array $params$username null$password null, array $driverOptions = [])
  3.     {
  4.         try {
  5.             $conn = new PDO\Connection(
  6.                 $this->constructPdoDsn($params),
  7.                 $username,
  8.                 $password,
  9.                 $driverOptions
  10.             );
  11.         } catch (PDOException $e) {
  1.         $driverOptions $this->params['driverOptions'] ?? [];
  2.         $user          $this->params['user'] ?? null;
  3.         $password      $this->params['password'] ?? null;
  4.         $this->_conn $this->_driver->connect($this->params$user$password$driverOptions);
  5.         $this->transactionNestingLevel 0;
  6.         if ($this->autoCommit === false) {
  7.             $this->beginTransaction();
  1.         }
  2.         // If not connected, we need to connect now to determine the platform version.
  3.         if ($this->_conn === null) {
  4.             try {
  5.                 $this->connect();
  6.             } catch (Throwable $originalException) {
  7.                 if (empty($this->params['dbname'])) {
  8.                     throw $originalException;
  9.                 }
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> getDatabasePlatformVersion (line 387)
  1.      *
  2.      * @throws Exception If an invalid platform was specified for this connection.
  3.      */
  4.     private function detectDatabasePlatform(): void
  5.     {
  6.         $version $this->getDatabasePlatformVersion();
  7.         if ($version !== null) {
  8.             assert($this->_driver instanceof VersionAwarePlatformDriver);
  9.             $this->platform $this->_driver->createDatabasePlatformForVersion($version);
in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php -> detectDatabasePlatform (line 330)
  1.      * @throws Exception
  2.      */
  3.     public function getDatabasePlatform()
  4.     {
  5.         if ($this->platform === null) {
  6.             $this->detectDatabasePlatform();
  7.         }
  8.         return $this->platform;
  9.     }
  1.      * @return Platforms\AbstractPlatform
  2.      */
  3.     private function getTargetPlatform()
  4.     {
  5.         if (!$this->targetPlatform) {
  6.             $this->targetPlatform $this->em->getConnection()->getDatabasePlatform();
  7.         }
  8.         return $this->targetPlatform;
  9.     }
  10. }
  1.      */
  2.     private function completeIdGeneratorMapping(ClassMetadataInfo $class)
  3.     {
  4.         $idGenType $class->generatorType;
  5.         if ($idGenType == ClassMetadata::GENERATOR_TYPE_AUTO) {
  6.             if ($this->getTargetPlatform()->prefersSequences()) {
  7.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_SEQUENCE);
  8.             } else if ($this->getTargetPlatform()->prefersIdentityColumns()) {
  9.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_IDENTITY);
  10.             } else {
  11.                 $class->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_TABLE);
  1.         // However this is only true if the hierarchy of parents contains the root entity,
  2.         // if it consists of mapped superclasses these don't necessarily include the id field.
  3.         if ($parent && $rootEntityFound) {
  4.             $this->inheritIdGeneratorMapping($class$parent);
  5.         } else {
  6.             $this->completeIdGeneratorMapping($class);
  7.         }
  8.         if (!$class->isMappedSuperclass) {
  9.             foreach ($class->embeddedClasses as $property => $embeddableClass) {
  1.             }
  2.             $class $this->newClassMetadataInstance($className);
  3.             $this->initializeReflection($class$reflService);
  4.             $this->doLoadMetadata($class$parent$rootEntityFound$visited);
  5.             $this->loadedMetadata[$className] = $class;
  6.             $parent $class;
  1.     /**
  2.      * {@inheritDoc}
  3.      */
  4.     protected function loadMetadata($name)
  5.     {
  6.         $loaded parent::loadMetadata($name);
  7.         array_map([$this'resolveDiscriminatorValue'], array_map([$this'getMetadataFor'], $loaded));
  8.         return $loaded;
  9.     }
  1.                 if ($cached instanceof ClassMetadata) {
  2.                     $this->loadedMetadata[$realClassName] = $cached;
  3.                     $this->wakeupReflection($cached$this->getReflectionService());
  4.                 } else {
  5.                     foreach ($this->loadMetadata($realClassName) as $loadedClassName) {
  6.                         $this->cacheDriver->save(
  7.                             $loadedClassName $this->cacheSalt,
  8.                             $this->loadedMetadata[$loadedClassName]
  9.                         );
  10.                     }
  1.      *
  2.      * @return \Doctrine\ORM\Mapping\ClassMetadata
  3.      */
  4.     public function getClassMetadata($className)
  5.     {
  6.         return $this->metadataFactory->getMetadataFor($className);
  7.     }
  8.     /**
  9.      * {@inheritDoc}
  10.      */
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function getRepository(EntityManagerInterface $entityManager$entityName): ObjectRepository
  5.     {
  6.         $metadata            $entityManager->getClassMetadata($entityName);
  7.         $repositoryServiceId $metadata->customRepositoryClassName;
  8.         $customRepositoryName $metadata->customRepositoryClassName;
  9.         if ($customRepositoryName !== null) {
  10.             // fetch from the container
  1.      *
  2.      * @return ObjectRepository|EntityRepository The repository class.
  3.      */
  4.     public function getRepository($entityName)
  5.     {
  6.         return $this->repositoryFactory->getRepository($this$entityName);
  7.     }
  8.     /**
  9.      * Determines whether an entity instance is managed in this EntityManager.
  10.      *
  1.      */
  2.     public function getRepository($persistentObjectName$persistentManagerName null)
  3.     {
  4.         return $this
  5.             ->selectManager($persistentObjectName$persistentManagerName)
  6.             ->getRepository($persistentObjectName);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      */
AbstractManagerRegistry->getRepository() in src/AgriVector/Service/Market/SellingOfferService.php (line 49)
  1.     /**
  2.      * @return SellingOfferRepository|ObjectRepository
  3.      */
  4.     protected function getRepository()
  5.     {
  6.         return $this->getManager()->getRepository(SellingOffer::class);
  7.     }
  8.     public function save(SellingOffer $sellingOffer)
  9.     {
  10.         $this->saveUploadedImages($sellingOffer);
SellingOfferService->getRepository() in src/AgriVector/Service/BaseService.php (line 29)
  1.      * @param array $orderBy
  2.      * @return ArrayCollection
  3.      */
  4.     public function findBy(array $criteria = [], array $orderBy null$limit null$offset null)
  5.     {
  6.         $itemList $this->getRepository()->findBy($criteria$orderBy$limit$offset);
  7.         return new ArrayCollection($itemList);
  8.     }
  9.     public function findOneBy(array $criteria = [], array $orderBy null)
  1.     public function getSellingOffersByTarget($target)
  2.     {
  3.         $sellingOffers = new ArrayCollection();
  4.         if (is_null($target) ||  $target != HomeController::TARGET_BUYER) {
  5.             $target HomeController::TARGET_FARMER;
  6.             $sellingOffers $this->findBy(['status' => true],[],3);
  7.         }
  8.         if ($target === HomeController::TARGET_BUYER) {
  9.             $sellingOffers $this->findBy(['status' => true],[],4);
  10.         }
  11.         return $sellingOffers;
SellingOfferService->getSellingOffersByTarget() in src/AgriVector/Controller/HomeController.php (line 47)
  1.      * @return Response
  2.      */
  3.     public function homeAction(SellingOfferService  $sellingOfferService$target self::TARGET_FARMER)
  4.     {
  5.         return $this->render('homepage/homepage.html.twig', [
  6.             'sellingOffers' => $sellingOfferService->getSellingOffersByTarget($target),
  7.             'target' => $target
  8.         ]);
  9.     }
  10.     /**
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $requestint $type HttpKernelInterface::MASTER_REQUESTbool $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 public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Traces 3

[3/3] ConnectionException

Doctrine\DBAL\Exception\ConnectionException:
An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:112
  at Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:182)
  at Doctrine\DBAL\DBALException::wrapException()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:169)
  at Doctrine\DBAL\DBALException::driverException()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:30)
  at Doctrine\DBAL\Driver\PDOMySql\Driver->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362)
  at Doctrine\DBAL\Connection->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:427)
  at Doctrine\DBAL\Connection->getDatabasePlatformVersion()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:387)
  at Doctrine\DBAL\Connection->detectDatabasePlatform()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:330)
  at Doctrine\DBAL\Connection->getDatabasePlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:801)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:628)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:166)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:306)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:82)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:185)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:288)
  at Doctrine\ORM\EntityManager->getClassMetadata()
     (vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:37)
  at Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:739)
  at Doctrine\ORM\EntityManager->getRepository()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/AbstractManagerRegistry.php:217)
  at Doctrine\Persistence\AbstractManagerRegistry->getRepository()
     (src/AgriVector/Service/Market/SellingOfferService.php:49)
  at App\AgriVector\Service\Market\SellingOfferService->getRepository()
     (src/AgriVector/Service/BaseService.php:29)
  at App\AgriVector\Service\BaseService->findBy()
     (src/AgriVector/Service/Market/SellingOfferService.php:117)
  at App\AgriVector\Service\Market\SellingOfferService->getSellingOffersByTarget()
     (src/AgriVector/Controller/HomeController.php:47)
  at App\AgriVector\Controller\HomeController->homeAction()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:195)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)                

[2/3] Exception

Doctrine\DBAL\Driver\PDO\Exception:
SQLSTATE[HY000] [2002] Connection refused

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
  at Doctrine\DBAL\Driver\PDO\Exception::new()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:42)
  at Doctrine\DBAL\Driver\PDOConnection->__construct()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:24)
  at Doctrine\DBAL\Driver\PDOMySql\Driver->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362)
  at Doctrine\DBAL\Connection->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:427)
  at Doctrine\DBAL\Connection->getDatabasePlatformVersion()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:387)
  at Doctrine\DBAL\Connection->detectDatabasePlatform()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:330)
  at Doctrine\DBAL\Connection->getDatabasePlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:801)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:628)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:166)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:306)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:82)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:185)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:288)
  at Doctrine\ORM\EntityManager->getClassMetadata()
     (vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:37)
  at Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:739)
  at Doctrine\ORM\EntityManager->getRepository()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/AbstractManagerRegistry.php:217)
  at Doctrine\Persistence\AbstractManagerRegistry->getRepository()
     (src/AgriVector/Service/Market/SellingOfferService.php:49)
  at App\AgriVector\Service\Market\SellingOfferService->getRepository()
     (src/AgriVector/Service/BaseService.php:29)
  at App\AgriVector\Service\BaseService->findBy()
     (src/AgriVector/Service/Market/SellingOfferService.php:117)
  at App\AgriVector\Service\Market\SellingOfferService->getSellingOffersByTarget()
     (src/AgriVector/Controller/HomeController.php:47)
  at App\AgriVector\Controller\HomeController->homeAction()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:195)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)                

[1/3] PDOException

PDOException:
SQLSTATE[HY000] [2002] Connection refused

  at vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38
  at PDO->__construct()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:38)
  at Doctrine\DBAL\Driver\PDOConnection->__construct()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php:24)
  at Doctrine\DBAL\Driver\PDOMySql\Driver->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:362)
  at Doctrine\DBAL\Connection->connect()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:427)
  at Doctrine\DBAL\Connection->getDatabasePlatformVersion()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:387)
  at Doctrine\DBAL\Connection->detectDatabasePlatform()
     (vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:330)
  at Doctrine\DBAL\Connection->getDatabasePlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:801)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->getTargetPlatform()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:628)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->completeIdGeneratorMapping()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:166)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->doLoadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:306)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->loadMetadata()
     (vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php:82)
  at Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/AbstractClassMetadataFactory.php:185)
  at Doctrine\Persistence\Mapping\AbstractClassMetadataFactory->getMetadataFor()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:288)
  at Doctrine\ORM\EntityManager->getClassMetadata()
     (vendor/doctrine/doctrine-bundle/Repository/ContainerRepositoryFactory.php:37)
  at Doctrine\Bundle\DoctrineBundle\Repository\ContainerRepositoryFactory->getRepository()
     (vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php:739)
  at Doctrine\ORM\EntityManager->getRepository()
     (vendor/doctrine/persistence/lib/Doctrine/Persistence/AbstractManagerRegistry.php:217)
  at Doctrine\Persistence\AbstractManagerRegistry->getRepository()
     (src/AgriVector/Service/Market/SellingOfferService.php:49)
  at App\AgriVector\Service\Market\SellingOfferService->getRepository()
     (src/AgriVector/Service/BaseService.php:29)
  at App\AgriVector\Service\BaseService->findBy()
     (src/AgriVector/Service/Market/SellingOfferService.php:117)
  at App\AgriVector\Service\Market\SellingOfferService->getSellingOffersByTarget()
     (src/AgriVector/Controller/HomeController.php:47)
  at App\AgriVector\Controller\HomeController->homeAction()
     (vendor/symfony/http-kernel/HttpKernel.php:157)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:195)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)