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

Open in your IDE?
  1. <?php
  2. /*
  3.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  4.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  5.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  6.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  7.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  8.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  9.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  10.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  11.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  12.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  13.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14.  *
  15.  * This software consists of voluntary contributions made by many individuals
  16.  * and is licensed under the MIT license. For more information, see
  17.  * <http://www.doctrine-project.org>.
  18.  */
  19. namespace Doctrine\ORM\Query\Expr;
  20. /**
  21.  * Expression class for DQL join.
  22.  *
  23.  * @link    www.doctrine-project.org
  24.  * @since   2.0
  25.  * @author  Guilherme Blanco <[email protected]>
  26.  * @author  Jonathan Wage <[email protected]>
  27.  * @author  Roman Borschel <[email protected]>
  28.  */
  29. class Join
  30. {
  31.     const INNER_JOIN    'INNER';
  32.     const LEFT_JOIN     'LEFT';
  33.     const ON            'ON';
  34.     const WITH          'WITH';
  35.     /**
  36.      * @var string
  37.      */
  38.     protected $joinType;
  39.     /**
  40.      * @var string
  41.      */
  42.     protected $join;
  43.     /**
  44.      * @var string
  45.      */
  46.     protected $alias;
  47.     /**
  48.      * @var string
  49.      */
  50.     protected $conditionType;
  51.     /**
  52.      * @var string
  53.      */
  54.     protected $condition;
  55.     /**
  56.      * @var string
  57.      */
  58.     protected $indexBy;
  59.     /**
  60.      * @param string      $joinType      The condition type constant. Either INNER_JOIN or LEFT_JOIN.
  61.      * @param string      $join          The relationship to join.
  62.      * @param string|null $alias         The alias of the join.
  63.      * @param string|null $conditionType The condition type constant. Either ON or WITH.
  64.      * @param string|null $condition     The condition for the join.
  65.      * @param string|null $indexBy       The index for the join.
  66.      */
  67.     public function __construct($joinType$join$alias null$conditionType null$condition null$indexBy null)
  68.     {
  69.         $this->joinType       $joinType;
  70.         $this->join           $join;
  71.         $this->alias          $alias;
  72.         $this->conditionType  $conditionType;
  73.         $this->condition      $condition;
  74.         $this->indexBy        $indexBy;
  75.     }
  76.     /**
  77.      * @return string 
  78.      */
  79.     public function getJoinType()
  80.     {
  81.         return $this->joinType;
  82.     }
  83.     /**
  84.      * @return string
  85.      */
  86.     public function getJoin()
  87.     {
  88.         return $this->join;
  89.     }
  90.     /**
  91.      * @return string
  92.      */
  93.     public function getAlias()
  94.     {
  95.         return $this->alias;
  96.     }
  97.     /**
  98.      * @return string
  99.      */
  100.     public function getConditionType()
  101.     {
  102.         return $this->conditionType;
  103.     }
  104.     /**
  105.      * @return string
  106.      */
  107.     public function getCondition()
  108.     {
  109.         return $this->condition;
  110.     }
  111.     /**
  112.      * @return string
  113.      */
  114.     public function getIndexBy()
  115.     {
  116.         return $this->indexBy;
  117.     }
  118.     /**
  119.      * @return string
  120.      */
  121.     public function __toString()
  122.     {
  123.         return strtoupper($this->joinType) . ' JOIN ' $this->join
  124.              . ($this->alias ' ' $this->alias '')
  125.              . ($this->indexBy ' INDEX BY ' $this->indexBy '')
  126.              . ($this->condition ' ' strtoupper($this->conditionType) . ' ' $this->condition '');
  127.     }
  128. }