Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Commit 74817d9

Browse files
committed
RELEASE_1_4_11 => v1.4.11 commit
1 parent 90eac7c commit 74817d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+337
-145
lines changed

CHANGELOG

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
03/30/11: Version 1.4.11
2+
------------------------
3+
4+
* Switched Doctrine external to our new mirror of the GitHub master branch
5+
16
03/21/11: Version 1.4.10
27
------------------------
38

lib/autoload/sfCoreAutoload.class.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/**
1212
* The current symfony version.
1313
*/
14-
define('SYMFONY_VERSION', '1.4.10');
14+
define('SYMFONY_VERSION', '1.4.11');
1515

1616
/**
1717
* sfCoreAutoload class.
@@ -22,7 +22,8 @@
2222
* @package symfony
2323
* @subpackage autoload
2424
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
25-
* @version SVN: $Id: sfCoreAutoload.class.php 32327 2011-03-21 15:47:58Z Kris.Wallsmith $
25+
* @version SVN: $Id: sfCoreAutoload.class.php 32410 2011-03-30 14:47:16Z Kris.Wallsmith
26+
$
2627
*/
2728
class sfCoreAutoload
2829
{

lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Db2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* $Id: Db2.php 7696 2011-03-21 12:10:28Z beberlei $
3+
* $Id: Db2.php 7490 2010-03-29 19:53:27Z jwage $
44
*
55
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -27,7 +27,7 @@
2727
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
2828
* @link www.doctrine-project.org
2929
* @since 1.0
30-
* @version $Revision: 7696 $
30+
* @version $Revision: 7490 $
3131
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
3232
*/
3333
class Doctrine_Connection_Db2 extends Doctrine_Connection_Common

lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Mssql.php

Lines changed: 125 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* $Id: Mssql.php 7659 2010-06-08 18:16:17Z jwage $
3+
* $Id: Mssql.php 7690 2010-08-31 17:11:24Z jwage $
44
*
55
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -27,7 +27,7 @@
2727
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
2828
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
2929
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
30-
* @version $Revision: 7659 $
30+
* @version $Revision: 7690 $
3131
* @link www.doctrine-project.org
3232
* @since 1.0
3333
*/
@@ -140,100 +140,154 @@ public function quoteIdentifier($identifier, $checkOption = false)
140140
* @link http://lists.bestpractical.com/pipermail/rt-devel/2005-June/007339.html
141141
* @return string
142142
*/
143-
public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false, $isSubQuery = false)
143+
public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false, $isSubQuery = false, Doctrine_Query $queryOrigin = null)
144144
{
145-
if ($limit > 0) {
146-
$count = intval($limit);
147-
$offset = intval($offset);
145+
if ($limit === false || !($limit > 0)) {
146+
return $query;
147+
}
148148

149-
if ($offset < 0) {
150-
throw new Doctrine_Connection_Exception("LIMIT argument offset=$offset is not valid");
151-
}
149+
$orderby = stristr($query, 'ORDER BY');
152150

153-
$orderby = stristr($query, 'ORDER BY');
151+
if ($offset !== false && $orderby === false) {
152+
throw new Doctrine_Connection_Exception("OFFSET cannot be used in MSSQL without ORDER BY due to emulation reasons.");
153+
}
154+
155+
$count = intval($limit);
156+
$offset = intval($offset);
154157

155-
if ($orderby !== false) {
156-
// Ticket #1835: Fix for ORDER BY alias
157-
// Ticket #2050: Fix for multiple ORDER BY clause
158-
$order = str_ireplace('ORDER BY', '', $orderby);
159-
$orders = explode(',', $order);
158+
if ($offset < 0) {
159+
throw new Doctrine_Connection_Exception("LIMIT argument offset=$offset is not valid");
160+
}
160161

161-
for ($i = 0; $i < count($orders); $i++) {
162-
$sorts[$i] = (stripos($orders[$i], ' desc') !== false) ? 'DESC' : 'ASC';
163-
$orders[$i] = trim(preg_replace('/\s+(ASC|DESC)$/i', '', $orders[$i]));
162+
$orderbySql = $queryOrigin->getSqlQueryPart('orderby');
163+
$orderbyDql = $queryOrigin->getDqlPart('orderby');
164164

165-
// find alias in query string
166-
$helper_string = stristr($query, $orders[$i]);
165+
if ($orderby !== false) {
166+
$orders = $this->parseOrderBy(implode(', ', $queryOrigin->getDqlPart('orderby')));
167167

168-
$from_clause_pos = strpos($helper_string, ' FROM ');
169-
$fields_string = substr($helper_string, 0, $from_clause_pos + 1);
168+
for ($i = 0; $i < count($orders); $i++) {
169+
$sorts[$i] = (stripos($orders[$i], ' desc') !== false) ? 'DESC' : 'ASC';
170+
$orders[$i] = trim(preg_replace('/\s+(ASC|DESC)$/i', '', $orders[$i]));
170171

171-
$field_array = explode(',', $fields_string);
172-
$field_array = array_shift($field_array);
173-
$aux2 = spliti(' as ', $field_array);
174-
$aux2 = explode('.', end($aux2));
172+
list($fieldAliases[$i], $fields[$i]) = strstr($orders[$i], '.') ? explode('.', $orders[$i]) : array('', $orders[$i]);
173+
$columnAlias[$i] = $queryOrigin->getSqlTableAlias($queryOrigin->getExpressionOwner($orders[$i]));
175174

176-
$aliases[$i] = trim(end($aux2));
177-
}
175+
$cmp = $queryOrigin->getQueryComponent($queryOrigin->getExpressionOwner($orders[$i]));
176+
$tables[$i] = $cmp['table'];
177+
$columns[$i] = $cmp['table']->getColumnName($fields[$i]);
178+
179+
// TODO: This sould be refactored as method called Doctrine_Table::getColumnAlias(<column name>).
180+
$aliases[$i] = $columnAlias[$i] . '__' . $columns[$i];
178181
}
182+
}
179183

180-
// Ticket #1259: Fix for limit-subquery in MSSQL
181-
$selectRegExp = 'SELECT\s+';
182-
$selectReplace = 'SELECT ';
184+
// Ticket #1259: Fix for limit-subquery in MSSQL
185+
$selectRegExp = 'SELECT\s+';
186+
$selectReplace = 'SELECT ';
183187

184-
if (preg_match('/^SELECT(\s+)DISTINCT/i', $query)) {
185-
$selectRegExp .= 'DISTINCT\s+';
186-
$selectReplace .= 'DISTINCT ';
187-
}
188+
if (preg_match('/^SELECT(\s+)DISTINCT/i', $query)) {
189+
$selectRegExp .= 'DISTINCT\s+';
190+
$selectReplace .= 'DISTINCT ';
191+
}
188192

189-
$fields_string = substr($query, strlen($selectReplace), strpos($query, ' FROM ') - strlen($selectReplace));
190-
$field_array = explode(',', $fields_string);
191-
$field_array = array_shift($field_array);
192-
$aux2 = spliti(' as ', $field_array);
193-
$aux2 = explode('.', end($aux2));
194-
$key_field = trim(end($aux2));
193+
$fields_string = substr($query, strlen($selectReplace), strpos($query, ' FROM ') - strlen($selectReplace));
194+
$field_array = explode(',', $fields_string);
195+
$field_array = array_shift($field_array);
196+
$aux2 = preg_split('/ as /i', $field_array);
197+
$aux2 = explode('.', end($aux2));
198+
$key_field = trim(end($aux2));
195199

196-
$query = preg_replace('/^'.$selectRegExp.'/i', $selectReplace . 'TOP ' . ($count + $offset) . ' ', $query);
200+
$query = preg_replace('/^'.$selectRegExp.'/i', $selectReplace . 'TOP ' . ($count + $offset) . ' ', $query);
197201

198-
if ($isSubQuery === true) {
199-
$query = 'SELECT TOP ' . $count . ' ' . $this->quoteIdentifier('inner_tbl') . '.' . $key_field . ' FROM (' . $query . ') AS ' . $this->quoteIdentifier('inner_tbl');
200-
} else {
201-
$query = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $query . ') AS ' . $this->quoteIdentifier('inner_tbl');
202-
}
202+
if ($isSubQuery === true) {
203+
$query = 'SELECT TOP ' . $count . ' ' . $this->quoteIdentifier('inner_tbl') . '.' . $key_field . ' FROM (' . $query . ') AS ' . $this->quoteIdentifier('inner_tbl');
204+
} else {
205+
$query = 'SELECT * FROM (SELECT TOP ' . $count . ' * FROM (' . $query . ') AS ' . $this->quoteIdentifier('inner_tbl');
206+
}
203207

204-
if ($orderby !== false) {
205-
$query .= ' ORDER BY ';
208+
if ($orderby !== false) {
209+
$query .= ' ORDER BY ';
206210

207-
for ($i = 0, $l = count($orders); $i < $l; $i++) {
208-
if ($i > 0) { // not first order clause
209-
$query .= ', ';
210-
}
211+
for ($i = 0, $l = count($orders); $i < $l; $i++) {
212+
if ($i > 0) { // not first order clause
213+
$query .= ', ';
214+
}
211215

212-
$query .= $this->quoteIdentifier('inner_tbl') . '.' . $aliases[$i] . ' ';
213-
$query .= (stripos($sorts[$i], 'asc') !== false) ? 'DESC' : 'ASC';
214-
}
216+
$query .= $this->modifyOrderByColumn($tables[$i], $columns[$i], $this->quoteIdentifier('inner_tbl') . '.' . $this->quoteIdentifier($aliases[$i])) . ' ';
217+
$query .= (stripos($sorts[$i], 'asc') !== false) ? 'DESC' : 'ASC';
215218
}
219+
}
216220

217-
if ($isSubQuery !== true) {
218-
$query .= ') AS ' . $this->quoteIdentifier('outer_tbl');
219-
220-
if ($orderby !== false) {
221-
$query .= ' ORDER BY ';
221+
if ($isSubQuery !== true) {
222+
$query .= ') AS ' . $this->quoteIdentifier('outer_tbl');
222223

223-
for ($i = 0, $l = count($orders); $i < $l; $i++) {
224-
if ($i > 0) { // not first order clause
225-
$query .= ', ';
226-
}
224+
if ($orderby !== false) {
225+
$query .= ' ORDER BY ';
227226

228-
$query .= $this->quoteIdentifier('outer_tbl') . '.' . $aliases[$i] . ' ' . $sorts[$i];
227+
for ($i = 0, $l = count($orders); $i < $l; $i++) {
228+
if ($i > 0) { // not first order clause
229+
$query .= ', ';
229230
}
231+
232+
$query .= $this->modifyOrderByColumn($tables[$i], $columns[$i], $this->quoteIdentifier('outer_tbl') . '.' . $this->quoteIdentifier($aliases[$i])) . ' ' . $sorts[$i];
230233
}
231234
}
232235
}
233236

234237
return $query;
235238
}
236239

240+
/**
241+
* Parse an OrderBy-Statement into chunks
242+
*
243+
* @param string $orderby
244+
*/
245+
private function parseOrderBy($orderby)
246+
{
247+
$matches = array();
248+
$chunks = array();
249+
$tokens = array();
250+
$parsed = str_ireplace('ORDER BY', '', $orderby);
251+
252+
preg_match_all('/(\w+\(.+?\)\s+(ASC|DESC)),?/', $orderby, $matches);
253+
254+
$matchesWithExpressions = $matches[1];
255+
256+
foreach ($matchesWithExpressions as $match) {
257+
$chunks[] = $match;
258+
$parsed = str_replace($match, '##' . (count($chunks) - 1) . '##', $parsed);
259+
}
260+
261+
$tokens = preg_split('/,/', $parsed);
262+
263+
for ($i = 0, $iMax = count($tokens); $i < $iMax; $i++) {
264+
$tokens[$i] = trim(preg_replace('/##(\d+)##/e', "\$chunks[\\1]", $tokens[$i]));
265+
}
266+
267+
return $tokens;
268+
}
269+
270+
/**
271+
* Order and Group By are not possible on columns from type text.
272+
* This method fix this issue by wrap the given term (column) into a CAST directive.
273+
*
274+
* @see DC-828
275+
* @param Doctrine_Table $table
276+
* @param string $field
277+
* @param string $term The term which will changed if it's necessary, depending to the field type.
278+
* @return string
279+
*/
280+
public function modifyOrderByColumn(Doctrine_Table $table, $field, $term)
281+
{
282+
$def = $table->getDefinitionOf($field);
283+
284+
if ($def['type'] == 'string' && $def['length'] === NULL) {
285+
$term = 'CAST(' . $term . ' AS varchar(8000))';
286+
}
287+
288+
return $term;
289+
}
290+
237291
/**
238292
* Creates dbms specific LIMIT/OFFSET SQL for the subqueries that are used in the
239293
* context of the limit-subquery algorithm.
@@ -347,18 +401,12 @@ public function exec($query, array $params = array())
347401
protected function replaceBoundParamsWithInlineValuesInQuery($query, array $params) {
348402

349403
foreach($params as $key => $value) {
350-
if(is_null($value)) {
351-
$value = 'NULL';
352-
}
353-
else {
354-
$value = $this->quote($value);
355-
}
356-
357-
$re = '/([=,\(][^\\\']*)(\?)/iU';
358-
359-
$query = preg_replace($re, "\\1 {$value}", $query, 1);
360-
404+
$re = '/(?<=WHERE|VALUES|SET|JOIN)(.*?)(\?)/';
405+
$query = preg_replace($re, "\\1##{$key}##", $query, 1);
361406
}
407+
408+
$replacement = 'is_null($value) ? \'NULL\' : $this->quote($params[\\1])';
409+
$query = preg_replace('/##(\d+)##/e', $replacement, $query);
362410

363411
return $query;
364412

lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection/Pgsql.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/*
3-
* $Id: Pgsql.php 7696 2011-03-21 12:10:28Z beberlei $
3+
* $Id: Pgsql.php 7490 2010-03-29 19:53:27Z jwage $
44
*
55
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -27,7 +27,7 @@
2727
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
2828
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
2929
* @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
30-
* @version $Revision: 7696 $
30+
* @version $Revision: 7490 $
3131
* @link www.doctrine-project.org
3232
* @since 1.0
3333
*/

lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ class Doctrine_Core
373373
*/
374374
const HYDRATE_RECORD_HIERARCHY = 9;
375375

376+
/**
377+
* HYDRATE_ARRAY_SHALLOW
378+
*/
379+
const HYDRATE_ARRAY_SHALLOW = 10;
380+
376381
/**
377382
* VALIDATION CONSTANTS
378383
*/

lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Export/Pgsql.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function alterTableSql($name, array $changes, $check = false)
159159
$query = 'ALTER ' . $fieldName . ' SET DEFAULT ' . $this->conn->quote($field['definition']['default'], $field['definition']['type']);
160160
$sql[] = 'ALTER TABLE ' . $this->conn->quoteIdentifier($name, true) . ' ' . $query;
161161
}
162-
if ( ! empty($field['definition']['notnull'])) {
162+
if ( isset($field['definition']['notnull'])) {
163163
$query = 'ALTER ' . $fieldName . ' ' . ($field['definition']['notnull'] ? 'SET' : 'DROP') . ' NOT NULL';
164164
$sql[] = 'ALTER TABLE ' . $this->conn->quoteIdentifier($name, true) . ' ' . $query;
165165
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
/*
3+
* $Id$
4+
*
5+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16+
*
17+
* This software consists of voluntary contributions made by many individuals
18+
* and is licensed under the LGPL. For more information, see
19+
* <http://www.doctrine-project.org>.
20+
*/
21+
22+
/**
23+
* Extended version of Doctrine_Hydrator_ScalarDriver, passes its _gatherRowData function a value of false for $aliasPrefix in order to cause it to generate the sorts of array keys one would see in a HYDRATE_ARRAY type return.
24+
* Note: This hydrator will have issues with fields in the return that have the same name (such as 2 fields each called id) -- the second field value will overwrite the first field.
25+
* @package Doctrine
26+
* @subpackage Hydrate
27+
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
28+
* @link www.doctrine-project.org
29+
* @since 1.2.3
30+
* @version $Revision$
31+
* @author Will Ferrer
32+
*/
33+
class Doctrine_Hydrator_ArrayShallowDriver extends Doctrine_Hydrator_ScalarDriver
34+
{
35+
public function hydrateResultSet($stmt)
36+
{
37+
$cache = array();
38+
$result = array();
39+
while ($data = $stmt->fetch(Doctrine_Core::FETCH_ASSOC)) {
40+
$result[] = $this->_gatherRowData($data, $cache, false);
41+
}
42+
return $result;
43+
}
44+
}

0 commit comments

Comments
 (0)