3 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 * This software consists of voluntary contributions made by many individuals
16 * and is licensed under the MIT license. For more information, see
17 * <http://www.doctrine-project.org>.
20 namespace Doctrine\ORM\Query;
23 * Encapsulates the resulting components from a DQL query parsing process that
26 * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
27 * @author Janne Vanhala <jpvanhal@cc.hut.fi>
28 * @author Roman Borschel <roman@code-factory.org>
29 * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
30 * @link http://www.doctrine-project.org
36 * The SQL executor used for executing the SQL.
38 * @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
40 private $_sqlExecutor;
43 * The ResultSetMapping that describes how to map the SQL result set.
45 * @var \Doctrine\ORM\Query\ResultSetMapping
47 private $_resultSetMapping;
50 * The mappings of DQL parameter names/positions to SQL parameter positions.
54 private $_parameterMappings = array();
57 * Initializes a new instance of the <tt>ParserResult</tt> class.
58 * The new instance is initialized with an empty <tt>ResultSetMapping</tt>.
60 public function __construct()
62 $this->_resultSetMapping = new ResultSetMapping;
66 * Gets the ResultSetMapping for the parsed query.
68 * @return ResultSetMapping The result set mapping of the parsed query or NULL
69 * if the query is not a SELECT query.
71 public function getResultSetMapping()
73 return $this->_resultSetMapping;
77 * Sets the ResultSetMapping of the parsed query.
79 * @param ResultSetMapping $rsm
81 public function setResultSetMapping(ResultSetMapping $rsm)
83 $this->_resultSetMapping = $rsm;
87 * Sets the SQL executor that should be used for this ParserResult.
89 * @param \Doctrine\ORM\Query\Exec\AbstractSqlExecutor $executor
91 public function setSqlExecutor($executor)
93 $this->_sqlExecutor = $executor;
97 * Gets the SQL executor used by this ParserResult.
99 * @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
101 public function getSqlExecutor()
103 return $this->_sqlExecutor;
107 * Adds a DQL to SQL parameter mapping. One DQL parameter name/position can map to
108 * several SQL parameter positions.
110 * @param string|integer $dqlPosition
111 * @param integer $sqlPosition
113 public function addParameterMapping($dqlPosition, $sqlPosition)
115 $this->_parameterMappings[$dqlPosition][] = $sqlPosition;
119 * Gets all DQL to SQL parameter mappings.
121 * @return array The parameter mappings.
123 public function getParameterMappings()
125 return $this->_parameterMappings;
129 * Gets the SQL parameter positions for a DQL parameter name/position.
131 * @param string|integer $dqlPosition The name or position of the DQL parameter.
132 * @return array The positions of the corresponding SQL parameters.
134 public function getSqlParameterPositions($dqlPosition)
136 return $this->_parameterMappings[$dqlPosition];