vendor/doctrine/orm/lib/Doctrine/ORM/Query/Expr/Join.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\ORM\Query\Expr;
  4. use function strtoupper;
  5. /**
  6.  * Expression class for DQL join.
  7.  *
  8.  * @link    www.doctrine-project.org
  9.  */
  10. class Join
  11. {
  12.     public const INNER_JOIN 'INNER';
  13.     public const LEFT_JOIN  'LEFT';
  14.     public const ON   'ON';
  15.     public const WITH 'WITH';
  16.     /** @var string */
  17.     protected $joinType;
  18.     /** @var string */
  19.     protected $join;
  20.     /** @var string|null */
  21.     protected $alias;
  22.     /** @var string|null */
  23.     protected $conditionType;
  24.     /** @var string|Comparison|Composite|null */
  25.     protected $condition;
  26.     /** @var string|null */
  27.     protected $indexBy;
  28.     /**
  29.      * @param string                           $joinType      The condition type constant. Either INNER_JOIN or LEFT_JOIN.
  30.      * @param string                           $join          The relationship to join.
  31.      * @param string|null                      $alias         The alias of the join.
  32.      * @param string|null                      $conditionType The condition type constant. Either ON or WITH.
  33.      * @param string|Comparison|Composite|null $condition     The condition for the join.
  34.      * @param string|null                      $indexBy       The index for the join.
  35.      */
  36.     public function __construct($joinType$join$alias null$conditionType null$condition null$indexBy null)
  37.     {
  38.         $this->joinType      $joinType;
  39.         $this->join          $join;
  40.         $this->alias         $alias;
  41.         $this->conditionType $conditionType;
  42.         $this->condition     $condition;
  43.         $this->indexBy       $indexBy;
  44.     }
  45.     /**
  46.      * @return string
  47.      */
  48.     public function getJoinType()
  49.     {
  50.         return $this->joinType;
  51.     }
  52.     /**
  53.      * @return string
  54.      */
  55.     public function getJoin()
  56.     {
  57.         return $this->join;
  58.     }
  59.     /**
  60.      * @return string|null
  61.      */
  62.     public function getAlias()
  63.     {
  64.         return $this->alias;
  65.     }
  66.     /**
  67.      * @return string|null
  68.      */
  69.     public function getConditionType()
  70.     {
  71.         return $this->conditionType;
  72.     }
  73.     /**
  74.      * @return string|Comparison|Composite|null
  75.      */
  76.     public function getCondition()
  77.     {
  78.         return $this->condition;
  79.     }
  80.     /**
  81.      * @return string|null
  82.      */
  83.     public function getIndexBy()
  84.     {
  85.         return $this->indexBy;
  86.     }
  87.     /**
  88.      * @return string
  89.      */
  90.     public function __toString()
  91.     {
  92.         return strtoupper($this->joinType) . ' JOIN ' $this->join
  93.              . ($this->alias ' ' $this->alias '')
  94.              . ($this->indexBy ' INDEX BY ' $this->indexBy '')
  95.              . ($this->condition ' ' strtoupper($this->conditionType) . ' ' $this->condition '');
  96.     }
  97. }