vendor/doctrine/orm/src/Query/Expr/From.php line 12

  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\ORM\Query\Expr;
  4. use Stringable;
  5. /**
  6. * Expression class for DQL from.
  7. *
  8. * @link www.doctrine-project.org
  9. */
  10. class From implements Stringable
  11. {
  12. /**
  13. * @param class-string $from The class name.
  14. * @param string $alias The alias of the class.
  15. */
  16. public function __construct(
  17. protected string $from,
  18. protected string $alias,
  19. protected string|null $indexBy = null,
  20. ) {
  21. }
  22. /** @return class-string */
  23. public function getFrom(): string
  24. {
  25. return $this->from;
  26. }
  27. public function getAlias(): string
  28. {
  29. return $this->alias;
  30. }
  31. public function getIndexBy(): string|null
  32. {
  33. return $this->indexBy;
  34. }
  35. public function __toString(): string
  36. {
  37. return $this->from . ' ' . $this->alias .
  38. ($this->indexBy ? ' INDEX BY ' . $this->indexBy : '');
  39. }
  40. }