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

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