Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
59576225
Commit
59576225
authored
Oct 10, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #157
Ticket: 157
parent
d83c193b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
Hydrate.php
lib/Doctrine/Hydrate.php
+4
-1
Query.php
lib/Doctrine/Query.php
+7
-5
QueryWhereTestCase.php
tests/QueryWhereTestCase.php
+13
-0
No files found.
lib/Doctrine/Hydrate.php
View file @
59576225
...
@@ -204,7 +204,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
...
@@ -204,7 +204,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
* @param string $path
* @param string $path
* @return string
* @return string
*/
*/
final
public
function
getTableAlias
(
$path
)
{
final
public
function
getTableAlias
(
$path
)
{
if
(
isset
(
$this
->
compAliases
[
$path
]))
$path
=
$this
->
compAliases
[
$path
];
if
(
!
isset
(
$this
->
tableAliases
[
$path
]))
if
(
!
isset
(
$this
->
tableAliases
[
$path
]))
return
false
;
return
false
;
...
...
lib/Doctrine/Query.php
View file @
59576225
...
@@ -650,14 +650,13 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
...
@@ -650,14 +650,13 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
}
}
return
$term
;
return
$term
;
}
}
/**
/**
* generateAlias
* generateAlias
*
*
* @param string $tableName
* @param string $tableName
* @return string
* @return string
*/
*/
final
public
function
generateAlias
(
$tableName
)
{
public
function
generateAlias
(
$tableName
)
{
if
(
isset
(
$this
->
tableIndexes
[
$tableName
]))
{
if
(
isset
(
$this
->
tableIndexes
[
$tableName
]))
{
return
$tableName
.++
$this
->
tableIndexes
[
$tableName
];
return
$tableName
.++
$this
->
tableIndexes
[
$tableName
];
}
else
{
}
else
{
...
@@ -688,9 +687,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
...
@@ -688,9 +687,7 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
}
else
}
else
$path
=
$tmp
[
0
];
$path
=
$tmp
[
0
];
if
(
$componentAlias
!==
false
)
{
$this
->
compAliases
[
$componentAlias
]
=
$path
;
}
$index
=
0
;
$index
=
0
;
$currPath
=
''
;
$currPath
=
''
;
...
@@ -816,6 +813,11 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
...
@@ -816,6 +813,11 @@ class Doctrine_Query extends Doctrine_Hydrate implements Countable {
throw
new
Doctrine_Query_Exception
(
$e
->
__toString
());
throw
new
Doctrine_Query_Exception
(
$e
->
__toString
());
}
}
}
}
if
(
$componentAlias
!==
false
)
{
$this
->
compAliases
[
$componentAlias
]
=
$currPath
;
}
return
$table
;
return
$table
;
}
}
/**
/**
...
...
tests/QueryWhereTestCase.php
View file @
59576225
...
@@ -5,6 +5,7 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
...
@@ -5,6 +5,7 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
$this
->
tables
=
array
(
'entity'
);
$this
->
tables
=
array
(
'entity'
);
parent
::
prepareTables
();
parent
::
prepareTables
();
}
}
public
function
testDirectParameterSetting
()
{
public
function
testDirectParameterSetting
()
{
$this
->
connection
->
clear
();
$this
->
connection
->
clear
();
...
@@ -36,6 +37,18 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
...
@@ -36,6 +37,18 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
}
}
public
function
testComponentAliases
()
{
$q
=
new
Doctrine_Query
();
$q
=
new
Doctrine_Query
();
$q
->
from
(
'User(id) u'
)
->
addWhere
(
'u.id IN (?, ?)'
,
array
(
1
,
2
));
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
->
count
(),
2
);
$this
->
assertEqual
(
$users
[
0
]
->
name
,
'someone'
);
$this
->
assertEqual
(
$users
[
1
]
->
name
,
'someone.2'
);
}
public
function
testOperatorWithNoTrailingSpaces
()
{
public
function
testOperatorWithNoTrailingSpaces
()
{
$q
=
new
Doctrine_Query
();
$q
=
new
Doctrine_Query
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment