QueryException.php 1019 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Doctrine\DBAL\Query;
  3. use Doctrine\DBAL\Exception;
  4. use function implode;
  5. /**
  6. * @psalm-immutable
  7. */
  8. class QueryException extends Exception
  9. {
  10. /**
  11. * @param string $alias
  12. * @param string[] $registeredAliases
  13. *
  14. * @return QueryException
  15. */
  16. public static function unknownAlias($alias, $registeredAliases)
  17. {
  18. return new self("The given alias '" . $alias . "' is not part of " .
  19. 'any FROM or JOIN clause table. The currently registered ' .
  20. 'aliases are: ' . implode(', ', $registeredAliases) . '.');
  21. }
  22. /**
  23. * @param string $alias
  24. * @param string[] $registeredAliases
  25. *
  26. * @return QueryException
  27. */
  28. public static function nonUniqueAlias($alias, $registeredAliases)
  29. {
  30. return new self("The given alias '" . $alias . "' is not unique " .
  31. 'in FROM and JOIN clause table. The currently registered ' .
  32. 'aliases are: ' . implode(', ', $registeredAliases) . '.');
  33. }
  34. }