QueryException.php 1.0 KB

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