Commit 33fc28ff authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Updated AST nodes to use public properties instead of setter/getter methods.

parent f087a005
...@@ -30,7 +30,12 @@ use Doctrine\DBAL\Types; ...@@ -30,7 +30,12 @@ use Doctrine\DBAL\Types;
* point of abstraction of platform-specific behaviors, features and SQL dialects. * point of abstraction of platform-specific behaviors, features and SQL dialects.
* They are a passive source of information. * They are a passive source of information.
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
*/ */
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace Doctrine\ORM; namespace Doctrine\ORM;
use Doctrine\ORM\Query\QueryException;
/** /**
* Base class for Query and NativeQuery. * Base class for Query and NativeQuery.
* *
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,34 +24,40 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,34 +24,40 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary * ArithmeticFactor ::= [("+" | "-")] ArithmeticPrimary
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ArithmeticFactor extends Node class ArithmeticFactor extends Node
{ {
private $_arithmeticPrimary; /**
private $_pSigned; * @var ArithmeticPrimary
private $_nSigned; */
public $arithmeticPrimary;
public function __construct($arithmeticPrimary, $pSigned = false, $nSigned = false) /**
{ * @var null|boolean NULL represents no sign, TRUE means positive and FALSE means negative sign
$this->_arithmeticPrimary = $arithmeticPrimary; */
$this->_pSigned = $pSigned; public $sign;
$this->_nSigned = $nSigned;
}
public function getArithmeticPrimary() public function __construct($arithmeticPrimary, $sign = null)
{ {
return $this->_arithmeticPrimary; $this->arithmeticPrimary = $arithmeticPrimary;
$this->sign = $sign;
} }
public function isPositiveSigned() public function isPositiveSigned()
{ {
return $this->_pSigned; return $this->sign === true;
} }
public function isNegativeSigned() public function isNegativeSigned()
{ {
return $this->_nSigned; return $this->sign === false;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}* * ArithmeticTerm ::= ArithmeticFactor {("*" | "/") ArithmeticFactor}*
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ArithmeticTerm extends Node class ArithmeticTerm extends Node
{ {
private $_factors; public $arithmeticFactors;
public function __construct(array $arithmeticFactors) public function __construct(array $arithmeticFactors)
{ {
$this->_factors = $arithmeticFactors; $this->arithmeticFactors = $arithmeticFactors;
}
public function getArithmeticFactors()
{
return $this->_factors;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,45 +24,26 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,45 +24,26 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Description of BetweenExpression * Description of BetweenExpression
* *
* @author robo @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class BetweenExpression extends Node class BetweenExpression extends Node
{ {
private $_baseExpression; public $expression;
private $_leftBetweenExpression; public $leftBetweenExpression;
private $_rightBetweenExpression; public $rightBetweenExpression;
private $_not; public $not;
public function __construct($baseExpr, $leftExpr, $rightExpr)
{
$this->_baseExpression = $baseExpr;
$this->_leftBetweenExpression = $leftExpr;
$this->_rightBetweenExpression = $rightExpr;
}
public function getBaseExpression()
{
return $this->_baseExpression;
}
public function getLeftBetweenExpression()
{
return $this->_leftBetweenExpression;
}
public function getRightBetweenExpression()
{
return $this->_rightBetweenExpression;
}
public function setNot($bool)
{
$this->_not = $bool;
}
public function getNot() public function __construct($expr, $leftExpr, $rightExpr)
{ {
return $this->_not; $this->expression = $expr;
$this->leftBetweenExpression = $leftExpr;
$this->rightBetweenExpression = $rightExpr;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpression * CollectionMemberExpression ::= EntityExpression ["NOT"] "MEMBER" ["OF"] CollectionValuedPathExpression
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class CollectionMemberExpression extends Node class CollectionMemberExpression extends Node
{ {
public $entityExpression; public $entityExpression;
public $collectionValuedPathExpression; public $collectionValuedPathExpression;
public $isNot; public $not;
public function __construct($entityExpr, $collValuedPathExpr, $isNot) public function __construct($entityExpr, $collValuedPathExpr)
{ {
$this->entityExpression = $entityExpr; $this->entityExpression = $entityExpr;
$this->collectionValuedPathExpression = $collValuedPathExpr; $this->collectionValuedPathExpression = $collValuedPathExpr;
$this->isNot = $isNot;
} }
public function dispatch($walker) public function dispatch($walker)
......
...@@ -29,34 +29,25 @@ namespace Doctrine\ORM\Query\AST; ...@@ -29,34 +29,25 @@ namespace Doctrine\ORM\Query\AST;
* DatetimeExpression ComparisonOperator (DatetimeExpression | QuantifiedExpression) | * DatetimeExpression ComparisonOperator (DatetimeExpression | QuantifiedExpression) |
* EntityExpression ("=" | "<>") (EntityExpression | QuantifiedExpression) * EntityExpression ("=" | "<>") (EntityExpression | QuantifiedExpression)
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ComparisonExpression extends Node class ComparisonExpression extends Node
{ {
private $_leftExpr; public $leftExpression;
private $_rightExpr; public $rightExpression;
private $_operator; public $operator;
public function __construct($leftExpr, $operator, $rightExpr) public function __construct($leftExpr, $operator, $rightExpr)
{ {
$this->_leftExpr = $leftExpr; $this->leftExpression = $leftExpr;
$this->_rightExpr = $rightExpr; $this->rightExpression = $rightExpr;
$this->_operator = $operator; $this->operator = $operator;
}
public function getLeftExpression()
{
return $this->_leftExpr;
}
public function getRightExpression()
{
return $this->_rightExpr;
}
public function getOperator()
{
return $this->_operator;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
namespace Doctrine\ORM\Query\AST;
/**
* ComparisonOperator = "=" | "<" | "<=" | "<>" | ">" | ">=" | "!="
*
* @package Doctrine
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org
* @since 2.0
* @version $Revision$
*/
class ComparisonOperator extends Node
{
public function dispatch($sqlWalker)
{
;
}
}
\ No newline at end of file
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}* * ConditionalExpression ::= ConditionalTerm {"OR" ConditionalTerm}*
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ConditionalExpression extends Node class ConditionalExpression extends Node
{ {
private $_conditionalTerms = array(); public $conditionalTerms = array();
public function __construct(array $conditionalTerms) public function __construct(array $conditionalTerms)
{ {
$this->_conditionalTerms = $conditionalTerms; $this->conditionalTerms = $conditionalTerms;
}
public function getConditionalTerms()
{
return $this->_conditionalTerms;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,27 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,27 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalFactor ::= ["NOT"] ConditionalPrimary * ConditionalFactor ::= ["NOT"] ConditionalPrimary
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ConditionalFactor extends Node class ConditionalFactor extends Node
{ {
private $_not = false; public $not = false;
private $_conditionalPrimary; public $conditionalPrimary;
public function __construct($conditionalPrimary, $not = false)
{
$this->_conditionalPrimary = $conditionalPrimary;
$this->_not = $not;
}
public function isNot()
{
return $this->_not;
}
public function getConditionalPrimary() public function __construct($conditionalPrimary)
{ {
return $this->_conditionalPrimary; $this->conditionalPrimary = $conditionalPrimary;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,41 +24,27 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,41 +24,27 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")" * ConditionalPrimary ::= SimpleConditionalExpression | "(" ConditionalExpression ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ConditionalPrimary extends Node class ConditionalPrimary extends Node
{ {
private $_simpleConditionalExpression; public $simpleConditionalExpression;
private $_conditionalExpression; public $conditionalExpression;
public function setSimpleConditionalExpression($simpleConditionalExpr)
{
$this->_simpleConditionalExpression = $simpleConditionalExpr;
}
public function setConditionalExpression($conditionalExpr)
{
$this->_conditionalExpression = $conditionalExpr;
}
public function getSimpleConditionalExpression()
{
return $this->_simpleConditionalExpression;
}
public function getConditionalExpression()
{
return $this->_conditionalExpression;
}
public function isSimpleConditionalExpression() public function isSimpleConditionalExpression()
{ {
return (bool) $this->_simpleConditionalExpression; return (bool) $this->simpleConditionalExpression;
} }
public function isConditionalExpression() public function isConditionalExpression()
{ {
return (bool) $this->_conditionalExpression; return (bool) $this->conditionalExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}* * ConditionalTerm ::= ConditionalFactor {"AND" ConditionalFactor}*
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ConditionalTerm extends Node class ConditionalTerm extends Node
{ {
private $_conditionalFactors = array(); public $conditionalFactors = array();
public function __construct(array $conditionalFactors) public function __construct(array $conditionalFactors)
{ {
$this->_conditionalFactors = $conditionalFactors; $this->conditionalFactors = $conditionalFactors;
}
public function getConditionalFactors()
{
return $this->_conditionalFactors;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -23,30 +23,23 @@ namespace Doctrine\ORM\Query\AST; ...@@ -23,30 +23,23 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* DeleteClause ::= "DELETE" ["FROM"] AbstractSchemaName [["AS"] AliasIdentificationVariable] * DeleteClause ::= "DELETE" ["FROM"] AbstractSchemaName [["AS"] AliasIdentificationVariable]
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class DeleteClause extends Node class DeleteClause extends Node
{ {
private $_abstractSchemaName; public $abstractSchemaName;
private $_aliasIdentificationVariable; public $aliasIdentificationVariable;
public function __construct($abstractSchemaName) public function __construct($abstractSchemaName)
{ {
$this->_abstractSchemaName = $abstractSchemaName; $this->abstractSchemaName = $abstractSchemaName;
}
public function getAbstractSchemaName()
{
return $this->_abstractSchemaName;
}
public function getAliasIdentificationVariable()
{
return $this->_aliasIdentificationVariable;
}
public function setAliasIdentificationVariable($alias)
{
$this->_aliasIdentificationVariable = $alias;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,35 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,35 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* DeleteStatement = DeleteClause [WhereClause] * DeleteStatement = DeleteClause [WhereClause]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class DeleteStatement extends Node class DeleteStatement extends Node
{ {
private $_deleteClause; public $deleteClause;
private $_whereClause; public $whereClause;
public function __construct($deleteClause) public function __construct($deleteClause)
{ {
$this->_deleteClause = $deleteClause; $this->deleteClause = $deleteClause;
}
public function setWhereClause($whereClause)
{
$this->_whereClause = $whereClause;
}
public function getDeleteClause()
{
return $this->_deleteClause;
}
public function getWhereClause()
{
return $this->_whereClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY" * EmptyCollectionComparisonExpression ::= CollectionValuedPathExpression "IS" ["NOT"] "EMPTY"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class EmptyCollectionComparisonExpression extends Node class EmptyCollectionComparisonExpression extends Node
{ {
private $_expression; public $expression;
private $_not; public $not;
public function __construct($expression) public function __construct($expression)
{ {
$this->_expression = $expression; $this->expression = $expression;
}
public function getExpression()
{
return $this->_expression;
}
public function setNot($bool)
{
$this->_not = $bool;
}
public function isNot()
{
return $this->_not;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")" * ExistsExpression ::= ["NOT"] "EXISTS" "(" Subselect ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ExistsExpression extends Node class ExistsExpression extends Node
{ {
private $_not = false; public $not;
private $_subselect; public $subselect;
public function __construct($subselect) public function __construct($subselect)
{ {
$this->_subselect = $subselect; $this->subselect = $subselect;
}
public function setNot($bool)
{
$this->_not = $bool;
}
public function isNot()
{
return $this->_not;
}
public function getSubselect()
{
return $this->_subselect;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* *
* This software consists of voluntary contributions made by many individuals * This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see * and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>. * <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration} * FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class FromClause extends Node class FromClause extends Node
{ {
protected $_identificationVariableDeclarations = array(); public $identificationVariableDeclarations = array();
public function __construct(array $identificationVariableDeclarations) public function __construct(array $identificationVariableDeclarations)
{ {
$this->_identificationVariableDeclarations = $identificationVariableDeclarations; $this->identificationVariableDeclarations = $identificationVariableDeclarations;
}
/* Getters */
public function getIdentificationVariableDeclarations()
{
return $this->_identificationVariableDeclarations;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,24 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,24 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "ABS" "(" SimpleArithmeticExpression ")" * "ABS" "(" SimpleArithmeticExpression ")"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class AbsFunction extends FunctionNode class AbsFunction extends FunctionNode
{ {
private $_simpleArithmeticExpression; public $simpleArithmeticExpression;
public function getSimpleArithmeticExpression()
{
return $this->_simpleArithmeticExpression;
}
/** /**
* @override * @override
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression(
return 'ABS(' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression) . ')'; $this->simpleArithmeticExpression
) . ')';
} }
/** /**
...@@ -37,7 +54,7 @@ class AbsFunction extends FunctionNode ...@@ -37,7 +54,7 @@ class AbsFunction extends FunctionNode
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression(); $this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "CONCAT" "(" StringPrimary "," StringPrimary ")" * "CONCAT" "(" StringPrimary "," StringPrimary ")"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class ConcatFunction extends FunctionNode class ConcatFunction extends FunctionNode
{ {
private $_firstStringPrimary; public $firstStringPrimary;
private $_secondStringPriamry; public $secondStringPriamry;
public function getFirstStringPrimary()
{
return $this->_firstStringPrimary;
}
public function getSecondStringPrimary()
{
return $this->_secondStringPrimary;
}
/** /**
* @override * @override
...@@ -33,8 +44,8 @@ class ConcatFunction extends FunctionNode ...@@ -33,8 +44,8 @@ class ConcatFunction extends FunctionNode
{ {
$platform = $sqlWalker->getConnection()->getDatabasePlatform(); $platform = $sqlWalker->getConnection()->getDatabasePlatform();
return $platform->getConcatExpression( return $platform->getConcatExpression(
$sqlWalker->walkStringPrimary($this->_firstStringPrimary), $sqlWalker->walkStringPrimary($this->firstStringPrimary),
$sqlWalker->walkStringPrimary($this->_secondStringPrimary) $sqlWalker->walkStringPrimary($this->secondStringPrimary)
); );
} }
...@@ -47,9 +58,9 @@ class ConcatFunction extends FunctionNode ...@@ -47,9 +58,9 @@ class ConcatFunction extends FunctionNode
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_firstStringPrimary = $parser->StringPrimary(); $this->firstStringPrimary = $parser->StringPrimary();
$parser->match(','); $parser->match(',');
$this->_secondStringPrimary = $parser->StringPrimary(); $this->secondStringPrimary = $parser->StringPrimary();
$parser->match(')'); $parser->match(')');
} }
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "CURRENT_DATE" * "CURRENT_DATE"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class CurrentDateFunction extends FunctionNode class CurrentDateFunction extends FunctionNode
{ {
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,7 +24,13 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,7 +24,13 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "CURRENT_TIME" * "CURRENT_TIME"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class CurrentTimeFunction extends FunctionNode class CurrentTimeFunction extends FunctionNode
{ {
......
...@@ -24,22 +24,23 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -24,22 +24,23 @@ namespace Doctrine\ORM\Query\AST\Functions;
use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\AST\Node;
/** /**
* Description of Function * Abtract Function Node.
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
abstract class FunctionNode extends Node abstract class FunctionNode extends Node
{ {
private $_name; public $name;
public function __construct($name) public function __construct($name)
{ {
$this->_name = $name; $this->name = $name;
}
public function getName()
{
return $this->_name;
} }
abstract public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker); abstract public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker);
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "LENGTH" "(" StringPrimary ")" * "LENGTH" "(" StringPrimary ")"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class LengthFunction extends FunctionNode class LengthFunction extends FunctionNode
{ {
private $_stringPrimary; public $stringPrimary;
public function getStringPrimary()
{
return $this->_stringPrimary;
}
/** /**
* @override * @override
...@@ -26,7 +42,7 @@ class LengthFunction extends FunctionNode ...@@ -26,7 +42,7 @@ class LengthFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
return 'LENGTH(' . $sqlWalker->walkStringPrimary($this->_stringPrimary) . ')'; return 'LENGTH(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
} }
/** /**
...@@ -35,9 +51,12 @@ class LengthFunction extends FunctionNode ...@@ -35,9 +51,12 @@ class LengthFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_stringPrimary = $parser->StringPrimary();
$this->stringPrimary = $parser->StringPrimary();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")" * "LOCATE" "(" StringPrimary "," StringPrimary ["," SimpleArithmeticExpression]")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class LocateFunction extends FunctionNode class LocateFunction extends FunctionNode
{ {
private $_firstStringPrimary; public $firstStringPrimary;
private $_secondStringPrimary; public $secondStringPrimary;
private $_simpleArithmeticExpression; public $simpleArithmeticExpression;
public function getFirstStringPrimary()
{
return $this->_firstStringPrimary;
}
public function getSecondStringPrimary()
{
return $this->_secondStringPrimary;
}
public function getSimpleArithmeticExpression()
{
return $this->_simpleArithmeticExpression;
}
/** /**
* @override * @override
...@@ -38,15 +44,12 @@ class LocateFunction extends FunctionNode ...@@ -38,15 +44,12 @@ class LocateFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
$sql = 'LOCATE(' . return 'LOCATE(' . $sqlWalker->walkStringPrimary($this->firstStringPrimary) . ', '
$sqlWalker->walkStringPrimary($this->_firstStringPrimary) . $sqlWalker->walkStringPrimary($this->secondStringPrimary)
. ', ' . . (($this->simpleArithmeticExpression)
$sqlWalker->walkStringPrimary($this->_secondStringPrimary); ? ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression)
: ''
if ($this->_simpleArithmeticExpression) { ) . ')';
$sql .= ', ' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression);
}
return $sql . ')';
} }
/** /**
...@@ -55,15 +58,22 @@ class LocateFunction extends FunctionNode ...@@ -55,15 +58,22 @@ class LocateFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_firstStringPrimary = $parser->StringPrimary();
$this->firstStringPrimary = $parser->StringPrimary();
$parser->match(','); $parser->match(',');
$this->_secondStringPrimary = $parser->StringPrimary();
$this->secondStringPrimary = $parser->StringPrimary();
if ($lexer->isNextToken(',')) { if ($lexer->isNextToken(',')) {
$parser->match(','); $parser->match(',');
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
} }
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "LOWER" "(" StringPrimary ")" * "LOWER" "(" StringPrimary ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class LowerFunction extends FunctionNode class LowerFunction extends FunctionNode
{ {
private $_stringPrimary; public $stringPrimary;
public function getStringPrimary()
{
return $this->_stringPrimary;
}
/** /**
* @override * @override
...@@ -26,7 +42,7 @@ class LowerFunction extends FunctionNode ...@@ -26,7 +42,7 @@ class LowerFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
return 'LOWER(' . $sqlWalker->walkStringPrimary($this->_stringPrimary) . ')'; return 'LOWER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
} }
/** /**
...@@ -35,9 +51,12 @@ class LowerFunction extends FunctionNode ...@@ -35,9 +51,12 @@ class LowerFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_stringPrimary = $parser->StringPrimary();
$this->stringPrimary = $parser->StringPrimary();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,22 +24,18 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")" * "MOD" "(" SimpleArithmeticExpression "," SimpleArithmeticExpression ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class ModFunction extends FunctionNode class ModFunction extends FunctionNode
{ {
private $_firstSimpleArithmeticExpression; public $firstSimpleArithmeticExpression;
private $_secondSimpleArithmeticExpression; public $secondSimpleArithmeticExpression;
public function getFirstSimpleArithmeticExpression()
{
return $this->_firstSimpleArithmeticExpression;
}
public function getSecondSimpleArithmeticExpression()
{
return $this->_secondSimpleArithmeticExpression;
}
/** /**
* @override * @override
...@@ -32,10 +43,10 @@ class ModFunction extends FunctionNode ...@@ -32,10 +43,10 @@ class ModFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
return 'SQRT(' . return 'SQRT('
$sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression) . $sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression)
. ', ' . . ', '
$sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression) . $sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression)
. ')'; . ')';
} }
...@@ -45,11 +56,16 @@ class ModFunction extends FunctionNode ...@@ -45,11 +56,16 @@ class ModFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(','); $parser->match(',');
$this->_secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(')'); $parser->match(')');
} }
} }
......
...@@ -24,30 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -24,30 +24,26 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "SIZE" "(" CollectionValuedPathExpression ")" * "SIZE" "(" CollectionValuedPathExpression ")"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class SizeFunction extends FunctionNode class SizeFunction extends FunctionNode
{ {
private $_collectionPathExpression; public $collectionPathExpression;
public function getCollectionPathExpression()
{
return $this->_collectionPathExpression;
}
public function setCollectionPathExpression($collPathExpr)
{
$this->_collectionPathExpression = $collPathExpr;
}
/** /**
* @override * @override
*/ */
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
$dqlAlias = $this->_collectionPathExpression->getIdentificationVariable(); $dqlAlias = $this->collectionPathExpression->identificationVariable;
$qComp = $sqlWalker->getQueryComponent($dqlAlias); $qComp = $sqlWalker->getQueryComponent($dqlAlias);
$parts = $this->_collectionPathExpression->getParts(); $parts = $this->collectionPathExpression->parts;
$assoc = $qComp['metadata']->associationMappings[$parts[0]]; $assoc = $qComp['metadata']->associationMappings[$parts[0]];
...@@ -80,9 +76,12 @@ class SizeFunction extends FunctionNode ...@@ -80,9 +76,12 @@ class SizeFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_collectionPathExpression = $parser->CollectionValuedPathExpression();
$this->collectionPathExpression = $parser->CollectionValuedPathExpression();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "SQRT" "(" SimpleArithmeticExpression ")" * "SQRT" "(" SimpleArithmeticExpression ")"
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
*/ */
class SqrtFunction extends FunctionNode class SqrtFunction extends FunctionNode
{ {
private $_simpleArithmeticExpression; public $simpleArithmeticExpression;
public function getSimpleArithmeticExpression()
{
return $this->_simpleArithmeticExpression;
}
/** /**
* @override * @override
...@@ -26,7 +42,7 @@ class SqrtFunction extends FunctionNode ...@@ -26,7 +42,7 @@ class SqrtFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
return 'SQRT(' . $sqlWalker->walkSimpleArithmeticExpression($this->_simpleArithmeticExpression) . ')'; return 'SQRT(' . $sqlWalker->walkSimpleArithmeticExpression($this->simpleArithmeticExpression) . ')';
} }
/** /**
...@@ -35,9 +51,12 @@ class SqrtFunction extends FunctionNode ...@@ -35,9 +51,12 @@ class SqrtFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->simpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,28 +24,19 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")" * "SUBSTRING" "(" StringPrimary "," SimpleArithmeticExpression "," SimpleArithmeticExpression ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SubstringFunction extends FunctionNode class SubstringFunction extends FunctionNode
{ {
private $_stringPrimary; public $stringPrimary;
private $_firstSimpleArithmeticExpression; public $firstSimpleArithmeticExpression;
private $_secondSimpleArithmeticExpression; public $secondSimpleArithmeticExpression;
public function geStringPrimary()
{
return $this->_stringPrimary;
}
public function getSecondSimpleArithmeticExpression()
{
return $this->_secondSimpleArithmeticExpression;
}
public function getFirstSimpleArithmeticExpression()
{
return $this->_firstSimpleArithmeticExpression;
}
/** /**
* @override * @override
...@@ -38,14 +44,13 @@ class SubstringFunction extends FunctionNode ...@@ -38,14 +44,13 @@ class SubstringFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
$sql = 'SUBSTRING(' . return 'SUBSTRING('
$sqlWalker->walkStringPrimary($this->_stringPrimary) . $sqlWalker->walkStringPrimary($this->stringPrimary)
. ', ' . . ', '
$sqlWalker->walkSimpleArithmeticExpression($this->_firstSimpleArithmeticExpression) . $sqlWalker->walkSimpleArithmeticExpression($this->firstSimpleArithmeticExpression)
. ', ' . . ', '
$sqlWalker->walkSimpleArithmeticExpression($this->_secondSimpleArithmeticExpression) . $sqlWalker->walkSimpleArithmeticExpression($this->secondSimpleArithmeticExpression)
. ')'; . ')';
return $sql;
} }
/** /**
...@@ -54,14 +59,18 @@ class SubstringFunction extends FunctionNode ...@@ -54,14 +59,18 @@ class SubstringFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(','); $parser->match(',');
$this->_firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(','); $parser->match(',');
$this->_secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$this->secondSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();
$parser->match(')'); $parser->match(')');
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -11,60 +26,21 @@ use Doctrine\ORM\Query\Lexer; ...@@ -11,60 +26,21 @@ use Doctrine\ORM\Query\Lexer;
/** /**
* "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")" * "TRIM" "(" [["LEADING" | "TRAILING" | "BOTH"] [char] "FROM"] StringPrimary ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class TrimFunction extends FunctionNode class TrimFunction extends FunctionNode
{ {
private $_leading; public $leading;
private $_trailing; public $trailing;
private $_both; public $both;
private $_trimChar; public $trimChar;
private $_stringPrimary; public $stringPrimary;
public function getStringPrimary()
{
return $this->_stringPrimary;
}
public function isLeading()
{
return $this->_leading;
}
public function setLeading($bool)
{
$this->_leading = $bool;
}
public function isTrailing()
{
return $this->_trailing;
}
public function setTrailing($bool)
{
$this->_trailing = $bool;
}
public function isBoth()
{
return $this->_both;
}
public function setBoth($bool)
{
$this->_both = $bool;
}
public function getTrimChar()
{
return $this->_trimChar;
}
public function setTrimChar($trimChar)
{
$this->_trimChar = $trimChar;
}
/** /**
* @override * @override
...@@ -72,13 +48,20 @@ class TrimFunction extends FunctionNode ...@@ -72,13 +48,20 @@ class TrimFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
$sql = 'TRIM('; $sql = 'TRIM(';
if ($this->_leading) $sql .= 'LEADING ';
else if ($this->_trailing) $sql .= 'TRAILING '; if ($this->leading) {
else if ($this->_both) $sql .= 'BOTH '; $sql .= 'LEADING ';
if ($this->_trimChar) $sql .= $sqlWalker->getConnection()->quote($this->_trimChar) . ' '; } else if ($this->trailing) {
$sql .= 'FROM ' . $sqlWalker->walkStringPrimary($this->_stringPrimary); $sql .= 'TRAILING ';
$sql .= ')'; } else if ($this->both) {
return $sql; $sql .= 'BOTH ';
}
if ($this->trimChar) {
$sql .= $sqlWalker->getConnection()->quote($this->trimChar) . ' ';
}
return $sql . 'FROM ' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
} }
/** /**
...@@ -87,30 +70,31 @@ class TrimFunction extends FunctionNode ...@@ -87,30 +70,31 @@ class TrimFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
if (strcasecmp('leading', $lexer->lookahead['value']) === 0) { if (strcasecmp('leading', $lexer->lookahead['value']) === 0) {
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$this->_leading = true; $this->leading = true;
} else if (strcasecmp('trailing', $lexer->lookahead['value']) === 0) { } else if (strcasecmp('trailing', $lexer->lookahead['value']) === 0) {
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$this->_trailing = true; $this->trailing = true;
} else if (strcasecmp('both', $lexer->lookahead['value']) === 0) { } else if (strcasecmp('both', $lexer->lookahead['value']) === 0) {
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$this->_both = true; $this->both = true;
} }
if ($lexer->isNextToken(Lexer::T_STRING)) { if ($lexer->isNextToken(Lexer::T_STRING)) {
$parser->match(Lexer::T_STRING); $parser->match(Lexer::T_STRING);
$this->_trimChar = $lexer->token['value']; $this->trimChar = $lexer->token['value'];
} }
if ($this->_leading || $this->_trailing || $this->_both || $this->_trimChar) { if ($this->leading || $this->trailing || $this->both || $this->trimChar) {
$parser->match(Lexer::T_FROM); $parser->match(Lexer::T_FROM);
} }
$this->_stringPrimary = $parser->StringPrimary(); $this->stringPrimary = $parser->StringPrimary();
$parser->match(')'); $parser->match(')');
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST\Functions; namespace Doctrine\ORM\Query\AST\Functions;
...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions; ...@@ -9,16 +24,17 @@ namespace Doctrine\ORM\Query\AST\Functions;
/** /**
* "UPPER" "(" StringPrimary ")" * "UPPER" "(" StringPrimary ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class UpperFunction extends FunctionNode class UpperFunction extends FunctionNode
{ {
private $_stringPrimary; public $stringPrimary;
public function getStringPrimary()
{
return $this->_stringPrimary;
}
/** /**
* @override * @override
...@@ -26,7 +42,7 @@ class UpperFunction extends FunctionNode ...@@ -26,7 +42,7 @@ class UpperFunction extends FunctionNode
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker)
{ {
//TODO: Use platform to get SQL //TODO: Use platform to get SQL
return 'UPPER(' . $sqlWalker->walkStringPrimary($this->_stringPrimary) . ')'; return 'UPPER(' . $sqlWalker->walkStringPrimary($this->stringPrimary) . ')';
} }
/** /**
...@@ -35,9 +51,12 @@ class UpperFunction extends FunctionNode ...@@ -35,9 +51,12 @@ class UpperFunction extends FunctionNode
public function parse(\Doctrine\ORM\Query\Parser $parser) public function parse(\Doctrine\ORM\Query\Parser $parser)
{ {
$lexer = $parser->getLexer(); $lexer = $parser->getLexer();
$parser->match($lexer->lookahead['value']); $parser->match($lexer->lookahead['value']);
$parser->match('('); $parser->match('(');
$this->_stringPrimary = $parser->StringPrimary();
$this->stringPrimary = $parser->StringPrimary();
$parser->match(')'); $parser->match(')');
} }
} }
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Description of GroupByClause * Description of GroupByClause
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class GroupByClause extends Node class GroupByClause extends Node
{ {
private $_groupByItems = array(); public $groupByItems = array();
public function __construct(array $groupByItems) public function __construct(array $groupByItems)
{ {
$this->_groupByItems = $groupByItems; $this->groupByItems = $groupByItems;
}
public function getGroupByItems()
{
return $this->_groupByItems;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Description of HavingClause * Description of HavingClause
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class HavingClause extends Node class HavingClause extends Node
{ {
private $_conditionalExpression; public $conditionalExpression;
public function __construct($conditionalExpression) public function __construct($conditionalExpression)
{ {
$this->_conditionalExpression = $conditionalExpression; $this->conditionalExpression = $conditionalExpression;
}
public function getConditionalExpression()
{
return $this->_conditionalExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,43 +24,25 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,43 +24,25 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}* * IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}*
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class IdentificationVariableDeclaration extends Node class IdentificationVariableDeclaration extends Node
{ {
protected $_rangeVariableDeclaration = null; public $rangeVariableDeclaration = null;
public $indexBy = null;
protected $_indexBy = null; public $joinVariableDeclarations = array();
protected $_joinVariableDeclarations = array();
public function __construct($rangeVariableDecl, $indexBy, array $joinVariableDecls) public function __construct($rangeVariableDecl, $indexBy, array $joinVariableDecls)
{ {
$this->_rangeVariableDeclaration = $rangeVariableDecl; $this->rangeVariableDeclaration = $rangeVariableDecl;
$this->_indexBy = $indexBy; $this->indexBy = $indexBy;
$this->_joinVariableDeclarations = $joinVariableDecls; $this->joinVariableDeclarations = $joinVariableDecls;
}
/* Getters */
public function getRangeVariableDeclaration()
{
return $this->_rangeVariableDeclaration;
}
public function getIndexBy()
{
return $this->_indexBy;
}
public function getJoinVariableDeclarations()
{
return $this->_joinVariableDeclarations;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,53 +24,24 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,53 +24,24 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* InExpression ::= StateFieldPathExpression ["NOT"] "IN" "(" (Literal {"," Literal}* | Subselect) ")" * InExpression ::= StateFieldPathExpression ["NOT"] "IN" "(" (Literal {"," Literal}* | Subselect) ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class InExpression extends Node class InExpression extends Node
{ {
private $_pathExpression; public $not;
private $_not = false; public $pathExpression;
private $_literals = array(); public $literals = array();
private $_subselect; public $subselect;
public function __construct($pathExpression) public function __construct($pathExpression)
{ {
$this->_pathExpression = $pathExpression; $this->pathExpression = $pathExpression;
}
public function setLiterals(array $literals)
{
$this->_literals = $literals;
}
public function getLiterals()
{
return $this->_literals;
}
public function setSubselect($subselect)
{
$this->_subselect = $subselect;
}
public function getSubselect()
{
return $this->_subselect;
}
public function setNot($bool)
{
$this->_not = $bool;
}
public function isNot()
{
return $this->_not;
}
public function getPathExpression()
{
return $this->_pathExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression * IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class IndexBy extends Node class IndexBy extends Node
{ {
protected $_simpleStateFieldPathExpression = null; public $simpleStateFieldPathExpression = null;
public function __construct($simpleStateFieldPathExpression) public function __construct($simpleStateFieldPathExpression)
{ {
$this->_simpleStateFieldPathExpression = $simpleStateFieldPathExpression; $this->simpleStateFieldPathExpression = $simpleStateFieldPathExpression;
}
/* Getters */
public function getSimpleStateFieldPathExpression()
{
return $this->_simpleStateFieldPathExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,13 +24,18 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,13 +24,18 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Description of InputParameter * Description of InputParameter
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class InputParameter extends Node class InputParameter extends Node
{ {
private $_isNamed; public $isNamed;
private $_position; public $name;
private $_name;
public function __construct($value) public function __construct($value)
{ {
...@@ -24,32 +44,8 @@ class InputParameter extends Node ...@@ -24,32 +44,8 @@ class InputParameter extends Node
} }
$param = substr($value, 1); $param = substr($value, 1);
$this->_isNamed = ! is_numeric($param); $this->isNamed = ! is_numeric($param);
if ($this->_isNamed) { $this->name = $param;
$this->_name = $param;
} else {
$this->_position = $param;
}
}
public function isNamed()
{
return $this->_isNamed;
}
public function isPositional()
{
return ! $this->_isNamed;
}
public function getName()
{
return $this->_name;
}
public function getPosition()
{
return $this->_position;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -25,11 +25,13 @@ namespace Doctrine\ORM\Query\AST; ...@@ -25,11 +25,13 @@ namespace Doctrine\ORM\Query\AST;
* Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression * Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression
* ["AS"] AliasIdentificationVariable [("ON" | "WITH") ConditionalExpression] * ["AS"] AliasIdentificationVariable [("ON" | "WITH") ConditionalExpression]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class Join extends Node class Join extends Node
{ {
...@@ -39,55 +41,17 @@ class Join extends Node ...@@ -39,55 +41,17 @@ class Join extends Node
const JOIN_WHERE_ON = 1; const JOIN_WHERE_ON = 1;
const JOIN_WHERE_WITH = 2; const JOIN_WHERE_WITH = 2;
protected $_joinType = self::JOIN_TYPE_INNER; public $joinType = self::JOIN_TYPE_INNER;
protected $_joinAssociationPathExpression = null; public $joinAssociationPathExpression = null;
protected $_aliasIdentificationVariable = null; public $aliasIdentificationVariable = null;
protected $_whereType = self::JOIN_WHERE_WITH; public $whereType = self::JOIN_WHERE_WITH;
protected $_conditionalExpression = null; public $conditionalExpression = null;
public function __construct($joinType, $joinAssocPathExpr, $aliasIdentVar) public function __construct($joinType, $joinAssocPathExpr, $aliasIdentVar)
{ {
$this->_joinType = $joinType; $this->joinType = $joinType;
$this->_joinAssociationPathExpression = $joinAssocPathExpr; $this->joinAssociationPathExpression = $joinAssocPathExpr;
$this->_aliasIdentificationVariable = $aliasIdentVar; $this->aliasIdentificationVariable = $aliasIdentVar;
}
/* Setters */
public function setWhereType($whereType)
{
$this->_whereType = $whereType;
}
public function setConditionalExpression($conditionalExpression)
{
$this->_conditionalExpression = $conditionalExpression;
}
/* Getters */
public function getJoinType()
{
return $this->_joinType;
}
public function getJoinAssociationPathExpression()
{
return $this->_joinAssociationPathExpression;
}
public function getAliasIdentificationVariable()
{
return $this->_aliasIdentificationVariable;
}
public function getWhereType()
{
return $this->_whereType;
}
public function getConditionalExpression()
{
return $this->_conditionalExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* JoinAssociationPathExpression ::= IdentificationVariable "." (SingleValuedAssociationField | CollectionValuedAssociationField) * JoinAssociationPathExpression ::= IdentificationVariable "." (SingleValuedAssociationField | CollectionValuedAssociationField)
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Roman Borschel * @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class JoinAssociationPathExpression extends Node class JoinAssociationPathExpression extends Node
{ {
private $_identificationVariable; public $identificationVariable;
private $_assocField; public $associationField;
public function __construct($identificationVariable, $assocField)
{
$this->_identificationVariable = $identificationVariable;
$this->_assocField = $assocField;
}
public function getIdentificationVariable()
{
return $this->_identificationVariable;
}
public function getAssociationField() public function __construct($identificationVariable, $associationField)
{ {
return $this->_assocField; $this->identificationVariable = $identificationVariable;
$this->associationField = $associationField;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,32 +24,23 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,32 +24,23 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* JoinVariableDeclaration ::= Join [IndexBy] * JoinVariableDeclaration ::= Join [IndexBy]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class JoinVariableDeclaration extends Node class JoinVariableDeclaration extends Node
{ {
protected $_join = null; public $join = null;
protected $_indexBy = null; public $indexBy = null;
public function __construct($join, $indexBy) public function __construct($join, $indexBy)
{ {
$this->_join = $join; $this->join = $join;
$this->_indexBy = $indexBy; $this->indexBy = $indexBy;
}
/* Getters */
public function getJoin()
{
return $this->_join;
}
public function getIndexBy()
{
return $this->_indexBy;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,41 +24,26 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,41 +24,26 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* LikeExpression ::= StringExpression ["NOT"] "LIKE" string ["ESCAPE" char] * LikeExpression ::= StringExpression ["NOT"] "LIKE" string ["ESCAPE" char]
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class LikeExpression extends Node class LikeExpression extends Node
{ {
private $_stringExpr; public $not;
private $_isNot; public $stringExpression;
private $_stringPattern; public $stringPattern;
private $_escapeChar; public $escapeChar;
public function __construct($stringExpr, $stringPattern, $isNot = false, $escapeChar = null)
{
$this->_stringExpr = $stringExpr;
$this->_stringPattern = $stringPattern;
$this->_isNot = $isNot;
$this->_escapeChar = $escapeChar;
}
public function isNot()
{
return $this->_isNot;
}
public function getStringExpression()
{
return $this->_stringExpr;
}
public function getStringPattern()
{
return $this->_stringPattern;
}
public function getEscapeChar() public function __construct($stringExpression, $stringPattern, $escapeChar = null)
{ {
return $this->_escapeChar; $this->stringExpression = $stringExpression;
$this->stringPattern = $stringPattern;
$this->escapeChar = $escapeChar;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,13 +24,13 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,13 +24,13 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Abstract class of an AST node * Abstract class of an AST node
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Roman Borschel <roman@code-factory.org>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
abstract class Node abstract class Node
{ {
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,31 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* NullComparisonExpression ::= (SingleValuedPathExpression | InputParameter) "IS" ["NOT"] "NULL" * NullComparisonExpression ::= (SingleValuedPathExpression | InputParameter) "IS" ["NOT"] "NULL"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class NullComparisonExpression extends Node class NullComparisonExpression extends Node
{ {
private $_expression; public $not;
private $_not; public $expression;
public function __construct($expression) public function __construct($expression)
{ {
$this->_expression = $expression; $this->expression = $expression;
}
public function getExpression()
{
return $this->_expression;
}
public function setNot($bool)
{
$this->_not = $bool;
}
public function isNot()
{
return $this->_not;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* OrderByClause ::= "ORDER" "BY" OrderByItem {"," OrderByItem}* * OrderByClause ::= "ORDER" "BY" OrderByItem {"," OrderByItem}*
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class OrderByClause extends Node class OrderByClause extends Node
{ {
private $_orderByItems = array(); public $orderByItems = array();
public function __construct(array $orderByItems) public function __construct(array $orderByItems)
{ {
$this->_orderByItems = $orderByItems; $this->orderByItems = $orderByItems;
}
public function getOrderByItems()
{
return $this->_orderByItems;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -22,48 +22,34 @@ ...@@ -22,48 +22,34 @@
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* AST node for the following grammar rule:
*
* OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"] * OrderByItem ::= (ResultVariable | StateFieldPathExpression) ["ASC" | "DESC"]
* *
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com> * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org> * @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/ */
class OrderByItem extends Node class OrderByItem extends Node
{ {
private $_expr; public $expression;
private $_asc; public $type;
private $_desc;
public function __construct($expr)
{
$this->_expr = $expr;
}
public function getExpression() public function __construct($expression)
{ {
return $this->_expr; $this->expression = $expression;
}
public function setAsc($bool)
{
$this->_asc = $bool;
} }
public function isAsc() public function isAsc()
{ {
return $this->_asc; return strtoupper($this->type) == 'ASC';
}
public function setDesc($bool)
{
$this->_desc = $bool;
} }
public function isDesc() public function isDesc()
{ {
return $this->_desc; return strtoupper($this->type) == 'DESC';
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* AST node for the following path expressions:
*
* AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression * AssociationPathExpression ::= CollectionValuedPathExpression | SingleValuedAssociationPathExpression
*
* SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression * SingleValuedPathExpression ::= StateFieldPathExpression | SingleValuedAssociationPathExpression
*
* StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression * StateFieldPathExpression ::= SimpleStateFieldPathExpression | SimpleStateFieldAssociationPathExpression
*
* SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField * SingleValuedAssociationPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* SingleValuedAssociationField
*
* CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField * CollectionValuedPathExpression ::= IdentificationVariable "." {SingleValuedAssociationField "."}* CollectionValuedAssociationField
*
* StateField ::= {EmbeddedClassStateField "."}* SimpleStateField * StateField ::= {EmbeddedClassStateField "."}* SimpleStateField
*
* SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField * SimpleStateFieldPathExpression ::= IdentificationVariable "." StateField
*
* SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField * SimpleStateFieldAssociationPathExpression ::= SingleValuedAssociationPathExpression "." StateField
* *
* @author Roman Borschel <roman@code-factory.org> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class PathExpression extends Node class PathExpression extends Node
{ {
...@@ -30,54 +45,21 @@ class PathExpression extends Node ...@@ -30,54 +45,21 @@ class PathExpression extends Node
const TYPE_SINGLE_VALUED_ASSOCIATION = 4; const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
const TYPE_STATE_FIELD = 8; const TYPE_STATE_FIELD = 8;
private $_type; public $type;
private $_expectedType; public $expectedType;
private $_identificationVariable; public $identificationVariable;
private $_parts; public $parts;
public function __construct($expectedType, $identificationVariable, array $parts) public function __construct($expectedType, $identificationVariable, array $parts)
{ {
$this->_expectedType = $expectedType; $this->expectedType = $expectedType;
$this->_identificationVariable = $identificationVariable; $this->identificationVariable = $identificationVariable;
$this->_parts = $parts; $this->parts = $parts;
}
public function getIdentificationVariable()
{
return $this->_identificationVariable;
}
public function getParts()
{
return $this->_parts;
}
public function setExpectedType($type)
{
$this->_expectedType;
}
public function getExpectedType()
{
return $this->_expectedType;
}
/**
* INTERNAL
*/
public function setType($type)
{
$this->_type = $type;
}
public function getType()
{
return $this->_type;
} }
public function dispatch($walker) public function dispatch($walker)
{ {
switch ($this->_type) { switch ($this->type) {
case self::TYPE_STATE_FIELD: case self::TYPE_STATE_FIELD:
return $walker->walkStateFieldPathExpression($this); return $walker->walkStateFieldPathExpression($this);
case self::TYPE_SINGLE_VALUED_ASSOCIATION: case self::TYPE_SINGLE_VALUED_ASSOCIATION:
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,18 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,18 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* QuantifiedExpression ::= ("ALL" | "ANY" | "SOME") "(" Subselect ")" * QuantifiedExpression ::= ("ALL" | "ANY" | "SOME") "(" Subselect ")"
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class QuantifiedExpression extends Node class QuantifiedExpression extends Node
{ {
private $_all; public $type;
private $_any; public $subselect;
private $_some;
private $_subselect;
public function __construct($subselect) public function __construct($subselect)
{ {
$this->_subselect = $subselect; $this->subselect = $subselect;
} }
public function getSubselect() public function getSubselect()
...@@ -30,32 +49,17 @@ class QuantifiedExpression extends Node ...@@ -30,32 +49,17 @@ class QuantifiedExpression extends Node
public function isAll() public function isAll()
{ {
return $this->_all; return strtoupper($this->type) == 'ALL';
} }
public function isAny() public function isAny()
{ {
return $this->_any; return strtoupper($this->type) == 'ANY';
} }
public function isSome() public function isSome()
{ {
return $this->_some; return strtoupper($this->type) == 'SOME';
}
public function setAll($bool)
{
$this->_all = $bool;
}
public function setAny($bool)
{
$this->_any = $bool;
}
public function setSome($bool)
{
$this->_some = $bool;
} }
/** /**
......
...@@ -24,39 +24,25 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,39 +24,25 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable * RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class RangeVariableDeclaration extends Node class RangeVariableDeclaration extends Node
{ {
private $_classMetadata; public $classMetadata;
private $_abstractSchemaName; public $abstractSchemaName;
private $_aliasIdentificationVariable; public $aliasIdentificationVariable;
public function __construct($classMetadata, $aliasIdentificationVar) public function __construct($classMetadata, $aliasIdentificationVar)
{ {
$this->_classMetadata = $classMetadata; $this->classMetadata = $classMetadata;
$this->_abstractSchemaName = $classMetadata->name; $this->abstractSchemaName = $classMetadata->name;
$this->_aliasIdentificationVariable = $aliasIdentificationVar; $this->aliasIdentificationVariable = $aliasIdentificationVar;
}
/* Getters */
public function getAbstractSchemaName()
{
return $this->_abstractSchemaName;
}
public function getAliasIdentificationVariable()
{
return $this->_aliasIdentificationVariable;
}
public function getClassMetadata()
{
return $this->_classMetadata;
} }
public function dispatch($walker) public function dispatch($walker)
......
...@@ -24,50 +24,23 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,50 +24,23 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression} * SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SelectClause extends Node class SelectClause extends Node
{ {
protected $_isDistinct; public $isDistinct;
public $selectExpressions = array();
protected $_selectExpressions = array();
public function __construct(array $selectExpressions, $isDistinct) public function __construct(array $selectExpressions, $isDistinct)
{ {
$this->_isDistinct = $isDistinct; $this->isDistinct = $isDistinct;
$this->_selectExpressions = $selectExpressions; $this->selectExpressions = $selectExpressions;
}
/* Getters */
public function isDistinct()
{
return $this->_isDistinct;
}
public function getSelectExpressions()
{
return $this->_selectExpressions;
}
/* REMOVE ME LATER. COPIED METHODS FROM SPLIT OF PRODUCTION INTO "AST" AND "PARSER" */
public function buildSql()
{
return 'SELECT ' . (($this->_isDistinct) ? 'DISTINCT ' : '')
. implode(', ', $this->_mapSelectExpressions());
}
protected function _mapSelectExpressions()
{
return array_map(array(&$this, '_mapSelectExpression'), $this->_selectExpressions);
}
protected function _mapSelectExpression($value)
{
return is_object($value) ? $value->buildSql() : $value;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -25,32 +25,23 @@ namespace Doctrine\ORM\Query\AST; ...@@ -25,32 +25,23 @@ namespace Doctrine\ORM\Query\AST;
* SelectExpression ::= IdentificationVariable ["." "*"] | StateFieldPathExpression | * SelectExpression ::= IdentificationVariable ["." "*"] | StateFieldPathExpression |
* (AggregateExpression | "(" Subselect ")") [["AS"] FieldAliasIdentificationVariable] * (AggregateExpression | "(" Subselect ")") [["AS"] FieldAliasIdentificationVariable]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SelectExpression extends Node class SelectExpression extends Node
{ {
protected $_expression; public $expression;
protected $_fieldIdentificationVariable; public $fieldIdentificationVariable;
public function __construct($expression, $fieldIdentificationVariable) public function __construct($expression, $fieldIdentificationVariable)
{ {
$this->_expression = $expression; $this->expression = $expression;
$this->_fieldIdentificationVariable = $fieldIdentificationVariable; $this->fieldIdentificationVariable = $fieldIdentificationVariable;
}
/* Getters */
public function getExpression()
{
return $this->_expression;
}
public function getFieldIdentificationVariable()
{
return $this->_fieldIdentificationVariable;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,60 +24,26 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,60 +24,26 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* SelectStatement = SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause] * SelectStatement = SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SelectStatement extends Node class SelectStatement extends Node
{ {
protected $_selectClause; public $selectClause;
protected $_fromClause; public $fromClause;
protected $_whereClause; public $whereClause;
protected $_groupByClause; public $groupByClause;
protected $_havingClause; public $havingClause;
protected $_orderByClause; public $orderByClause;
public function __construct($selectClause, $fromClause, $whereClause, $groupByClause, public function __construct($selectClause, $fromClause) {
$havingClause, $orderByClause) { $this->selectClause = $selectClause;
$this->_selectClause = $selectClause; $this->fromClause = $fromClause;
$this->_fromClause = $fromClause;
$this->_whereClause = $whereClause;
$this->_groupByClause = $groupByClause;
$this->_havingClause = $havingClause;
$this->_orderByClause = $orderByClause;
}
/* Getters */
public function getSelectClause()
{
return $this->_selectClause;
}
public function getFromClause()
{
return $this->_fromClause;
}
public function getWhereClause()
{
return $this->_whereClause;
}
public function getGroupByClause()
{
return $this->_groupByClause;
}
public function getHavingClause()
{
return $this->_havingClause;
}
public function getOrderByClause()
{
return $this->_orderByClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -9,20 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}* * SimpleArithmeticExpression ::= ArithmeticTerm {("+" | "-") ArithmeticTerm}*
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SimpleArithmeticExpression extends Node class SimpleArithmeticExpression extends Node
{ {
private $_terms; public $arithmeticTerms = array();
public function __construct(array $arithmeticTerms) public function __construct(array $arithmeticTerms)
{ {
$this->_terms = $arithmeticTerms; $this->arithmeticTerms = $arithmeticTerms;
}
public function getArithmeticTerms()
{
return $this->_terms;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,36 +24,23 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,36 +24,23 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* SimpleSelectClause ::= "SELECT" ["DISTINCT"] SimpleSelectExpression * SimpleSelectClause ::= "SELECT" ["DISTINCT"] SimpleSelectExpression
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SimpleSelectClause extends Node class SimpleSelectClause extends Node
{ {
private $_isDistinct = false; public $isDistinct = false;
private $_simpleSelectExpression; public $simpleSelectExpression;
public function __construct($simpleSelectExpression)
{
$this->_simpleSelectExpression = $simpleSelectExpression;
}
/* Getters */
public function isDistinct()
{
return $this->_isDistinct;
}
public function setDistinct($bool)
{
$this->_isDistinct = $bool;
}
public function getSimpleSelectExpression() public function __construct($simpleSelectExpression, $isDistinct)
{ {
return $this->_simpleSelectExpression; $this->simpleSelectExpression = $simpleSelectExpression;
$this->isDistinct = $isDistinct;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -25,35 +25,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -25,35 +25,22 @@ namespace Doctrine\ORM\Query\AST;
* SimpleSelectExpression ::= StateFieldPathExpression | IdentificationVariable * SimpleSelectExpression ::= StateFieldPathExpression | IdentificationVariable
* | (AggregateExpression [["AS"] FieldAliasIdentificationVariable]) * | (AggregateExpression [["AS"] FieldAliasIdentificationVariable])
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SimpleSelectExpression extends Node class SimpleSelectExpression extends Node
{ {
private $_expression; public $expression;
private $_fieldIdentificationVariable; public $fieldIdentificationVariable;
public function __construct($expression) public function __construct($expression)
{ {
$this->_expression = $expression; $this->expression = $expression;
}
public function getExpression()
{
return $this->_expression;
}
public function getFieldIdentificationVariable()
{
return $this->_fieldIdentificationVariable;
}
public function setFieldIdentificationVariable($fieldAlias)
{
$this->_fieldIdentificationVariable = $fieldAlias;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,76 +24,27 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,76 +24,27 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause] * Subselect ::= SimpleSelectClause SubselectFromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class Subselect extends Node class Subselect extends Node
{ {
private $_simpleSelectClause; public $simpleSelectClause;
private $_subselectFromClause; public $subselectFromClause;
private $_whereClause; public $whereClause;
private $_groupByClause; public $groupByClause;
private $_havingClause; public $havingClause;
private $_orderByClause; public $orderByClause;
public function __construct($simpleSelectClause, $subselectFromClause) public function __construct($simpleSelectClause, $subselectFromClause)
{ {
$this->_simpleSelectClause = $simpleSelectClause; $this->simpleSelectClause = $simpleSelectClause;
$this->_subselectFromClause = $subselectFromClause; $this->subselectFromClause = $subselectFromClause;
}
/* Getters */
public function getSimpleSelectClause()
{
return $this->_simpleSelectClause;
}
public function getSubselectFromClause()
{
return $this->_subselectFromClause;
}
public function getWhereClause()
{
return $this->_whereClause;
}
public function setWhereClause($whereClause)
{
$this->_whereClause = $whereClause;
}
public function getGroupByClause()
{
return $this->_groupByClause;
}
public function setGroupByClause($groupByClause)
{
$this->_groupByClause = $groupByClause;
}
public function getHavingClause()
{
return $this->_havingClause;
}
public function setHavingClause($havingClause)
{
$this->_havingClause = $havingClause;
}
public function getOrderByClause()
{
return $this->_orderByClause;
}
public function setOrderByClause($orderByClause)
{
$this->_orderByClause = $orderByClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,25 +24,21 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* SubselectFromClause ::= "FROM" SubselectIdentificationVariableDeclaration {"," SubselectIdentificationVariableDeclaration}* * SubselectFromClause ::= "FROM" SubselectIdentificationVariableDeclaration {"," SubselectIdentificationVariableDeclaration}*
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class SubselectFromClause extends Node class SubselectFromClause extends Node
{ {
private $_identificationVariableDeclarations = array(); public $identificationVariableDeclarations = array();
public function __construct(array $identificationVariableDeclarations) public function __construct(array $identificationVariableDeclarations)
{ {
$this->_identificationVariableDeclarations = $identificationVariableDeclarations; $this->identificationVariableDeclarations = $identificationVariableDeclarations;
}
/* Getters */
public function getSubselectIdentificationVariableDeclarations()
{
return $this->_identificationVariableDeclarations;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* UpdateClause ::= "UPDATE" AbstractSchemaName [["AS"] AliasIdentificationVariable] "SET" UpdateItem {"," UpdateItem}* * UpdateClause ::= "UPDATE" AbstractSchemaName [["AS"] AliasIdentificationVariable] "SET" UpdateItem {"," UpdateItem}*
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class UpdateClause extends Node class UpdateClause extends Node
{ {
private $_abstractSchemaName; public $abstractSchemaName;
private $_aliasIdentificationVariable; public $aliasIdentificationVariable;
private $_updateItems = array(); public $updateItems = array();
public function __construct($abstractSchemaName, array $updateItems) public function __construct($abstractSchemaName, array $updateItems)
{ {
$this->_abstractSchemaName = $abstractSchemaName; $this->abstractSchemaName = $abstractSchemaName;
$this->_updateItems = $updateItems; $this->updateItems = $updateItems;
}
public function getAbstractSchemaName()
{
return $this->_abstractSchemaName;
}
public function getAliasIdentificationVariable()
{
return $this->_aliasIdentificationVariable;
}
public function setAliasIdentificationVariable($alias)
{
$this->_aliasIdentificationVariable = $alias;
}
public function getUpdateItems()
{
return $this->_updateItems;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -26,39 +26,24 @@ namespace Doctrine\ORM\Query\AST; ...@@ -26,39 +26,24 @@ namespace Doctrine\ORM\Query\AST;
* NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary | * NewValue ::= SimpleArithmeticExpression | StringPrimary | DatetimePrimary | BooleanPrimary |
* EnumPrimary | SimpleEntityExpression | "NULL" * EnumPrimary | SimpleEntityExpression | "NULL"
* *
* @author Roman Borschel <roman@code-factory.org> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class UpdateItem extends Node class UpdateItem extends Node
{ {
private $_identificationVariable; public $identificationVariable;
private $_field; public $field;
private $_newValue; public $newValue;
public function __construct($field, $newValue) public function __construct($field, $newValue)
{ {
$this->_field = $field; $this->field = $field;
$this->_newValue = $newValue; $this->newValue = $newValue;
}
public function setIdentificationVariable($identVar)
{
$this->_identificationVariable = $identVar;
}
public function getIdentificationVariable()
{
return $this->_identificationVariable;
}
public function getField()
{
return $this->_field;
}
public function getNewValue()
{
return $this->_newValue;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -24,35 +24,22 @@ namespace Doctrine\ORM\Query\AST; ...@@ -24,35 +24,22 @@ namespace Doctrine\ORM\Query\AST;
/** /**
* UpdateStatement = UpdateClause [WhereClause] * UpdateStatement = UpdateClause [WhereClause]
* *
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @version $Revision$ * @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class UpdateStatement extends Node class UpdateStatement extends Node
{ {
private $_updateClause; public $updateClause;
private $_whereClause; public $whereClause;
public function __construct($updateClause) public function __construct($updateClause)
{ {
$this->_updateClause = $updateClause; $this->updateClause = $updateClause;
}
public function setWhereClause($whereClause)
{
$this->_whereClause = $whereClause;
}
public function getUpdateClause()
{
return $this->_updateClause;
}
public function getWhereClause()
{
return $this->_whereClause;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
<?php <?php
/* /*
* To change this template, choose Tools | Templates * $Id$
* and open the template in the editor. *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.doctrine-project.org>.
*/ */
namespace Doctrine\ORM\Query\AST; namespace Doctrine\ORM\Query\AST;
/** /**
* Description of WhereClause * WhereClause ::= "WHERE" ConditionalExpression
* *
* @author robo * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 3938 $
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/ */
class WhereClause extends Node class WhereClause extends Node
{ {
private $_conditionalExpression; public $conditionalExpression;
public function __construct($conditionalExpression) public function __construct($conditionalExpression)
{ {
$this->_conditionalExpression = $conditionalExpression; $this->conditionalExpression = $conditionalExpression;
}
public function getConditionalExpression()
{
return $this->_conditionalExpression;
} }
public function dispatch($sqlWalker) public function dispatch($sqlWalker)
......
...@@ -53,9 +53,9 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor ...@@ -53,9 +53,9 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$conn = $em->getConnection(); $conn = $em->getConnection();
$primaryClass = $sqlWalker->getEntityManager()->getClassMetadata( $primaryClass = $sqlWalker->getEntityManager()->getClassMetadata(
$AST->getDeleteClause()->getAbstractSchemaName() $AST->deleteClause->abstractSchemaName
); );
$primaryDqlAlias = $AST->getDeleteClause()->getAliasIdentificationVariable(); $primaryDqlAlias = $AST->deleteClause->aliasIdentificationVariable;
$rootClass = $em->getClassMetadata($primaryClass->rootEntityName); $rootClass = $em->getClassMetadata($primaryClass->rootEntityName);
$tempTable = $rootClass->getTemporaryIdTableName(); $tempTable = $rootClass->getTemporaryIdTableName();
...@@ -71,8 +71,8 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor ...@@ -71,8 +71,8 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
// Append WHERE clause, if there is one. // Append WHERE clause, if there is one.
if ($AST->getWhereClause()) { if ($AST->whereClause) {
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->getWhereClause()); $this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause);
} }
// 2. Create ID subselect statement used in DELETE .... WHERE ... IN (subselect) // 2. Create ID subselect statement used in DELETE .... WHERE ... IN (subselect)
......
...@@ -53,13 +53,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -53,13 +53,12 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
{ {
$em = $sqlWalker->getEntityManager(); $em = $sqlWalker->getEntityManager();
$conn = $em->getConnection(); $conn = $em->getConnection();
$updateClause = $AST->updateClause;
$primaryClass = $sqlWalker->getEntityManager()->getClassMetadata( $primaryClass = $sqlWalker->getEntityManager()->getClassMetadata($updateClause->abstractSchemaName);
$AST->getUpdateClause()->getAbstractSchemaName()
);
$rootClass = $em->getClassMetadata($primaryClass->rootEntityName); $rootClass = $em->getClassMetadata($primaryClass->rootEntityName);
$updateItems = $AST->getUpdateClause()->getUpdateItems(); $updateItems = $updateClause->updateItems;
$tempTable = $rootClass->getTemporaryIdTableName(); $tempTable = $rootClass->getTemporaryIdTableName();
$idColumnNames = $rootClass->getIdentifierColumnNames(); $idColumnNames = $rootClass->getIdentifierColumnNames();
...@@ -68,8 +67,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -68,8 +67,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
// 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause() // 1. Create an INSERT INTO temptable ... SELECT identifiers WHERE $AST->getWhereClause()
$this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
. ' SELECT t0.' . implode(', t0.', $idColumnNames); . ' SELECT t0.' . implode(', t0.', $idColumnNames);
$sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $AST->getUpdateClause()->getAliasIdentificationVariable(), 't0'); $sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $updateClause->aliasIdentificationVariable, 't0');
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $AST->getUpdateClause()->getAliasIdentificationVariable()); $rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $updateClause->aliasIdentificationVariable);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
...@@ -79,6 +78,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -79,6 +78,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
// 3. Create and store UPDATE statements // 3. Create and store UPDATE statements
$classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses); $classNames = array_merge($primaryClass->parentClasses, array($primaryClass->name), $primaryClass->subClasses);
$i = -1; $i = -1;
foreach (array_reverse($classNames) as $className) { foreach (array_reverse($classNames) as $className) {
$affected = false; $affected = false;
$class = $em->getClassMetadata($className); $class = $em->getClassMetadata($className);
...@@ -86,19 +86,22 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -86,19 +86,22 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
$updateSql = 'UPDATE ' . $conn->quoteIdentifier($tableName) . ' SET '; $updateSql = 'UPDATE ' . $conn->quoteIdentifier($tableName) . ' SET ';
foreach ($updateItems as $updateItem) { foreach ($updateItems as $updateItem) {
$field = $updateItem->getField(); $field = $updateItem->field;
if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited'])) { if (isset($class->fieldMappings[$field]) && ! isset($class->fieldMappings[$field]['inherited'])) {
$newValue = $updateItem->getNewValue(); $newValue = $updateItem->newValue;
if ( ! $affected) { if ( ! $affected) {
$affected = true; $affected = true;
++$i; ++$i;
} else { } else {
$updateSql .= ', '; $updateSql .= ', ';
} }
$updateSql .= $sqlWalker->walkUpdateItem($updateItem); $updateSql .= $sqlWalker->walkUpdateItem($updateItem);
//FIXME: parameters can be more deeply nested. traverse the tree. //FIXME: parameters can be more deeply nested. traverse the tree.
if ($newValue instanceof AST\InputParameter) { if ($newValue instanceof AST\InputParameter) {
$paramKey = $newValue->isNamed() ? $newValue->getName() : $newValue->getPosition(); $paramKey = $newValue->name;
$this->_sqlParameters[$i][] = $sqlWalker->getQuery()->getParameter($paramKey); $this->_sqlParameters[$i][] = $sqlWalker->getQuery()->getParameter($paramKey);
++$this->_numParametersInUpdateClause; ++$this->_numParametersInUpdateClause;
} }
...@@ -111,8 +114,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -111,8 +114,8 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
} }
// Append WHERE clause to insertSql, if there is one. // Append WHERE clause to insertSql, if there is one.
if ($AST->getWhereClause()) { if ($AST->whereClause) {
$this->_insertSql .= $sqlWalker->walkWhereClause($AST->getWhereClause()); $this->_insertSql .= $sqlWalker->walkWhereClause($AST->whereClause);
} }
// 4. Store DDL for temporary identifier table. // 4. Store DDL for temporary identifier table.
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment