EchoSQLLogger.php 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace Doctrine\DBAL\Logging;
  3. use Doctrine\Deprecations\Deprecation;
  4. use function var_dump;
  5. use const PHP_EOL;
  6. /**
  7. * A SQL logger that logs to the standard output using echo/var_dump.
  8. *
  9. * @deprecated
  10. */
  11. class EchoSQLLogger implements SQLLogger
  12. {
  13. public function __construct()
  14. {
  15. Deprecation::trigger(
  16. 'doctrine/dbal',
  17. 'https://github.com/doctrine/dbal/pull/3935',
  18. 'EchoSQLLogger is deprecated without replacement, move the code into your project if you rely on it.'
  19. );
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function startQuery($sql, ?array $params = null, ?array $types = null)
  25. {
  26. echo $sql . PHP_EOL;
  27. if ($params) {
  28. var_dump($params);
  29. }
  30. if (! $types) {
  31. return;
  32. }
  33. var_dump($types);
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function stopQuery()
  39. {
  40. }
  41. }