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
0a7727e1
Commit
0a7727e1
authored
Jan 04, 2010
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0][DDC-234] Make sure is defined in QueryBuilder Expressions.
parent
ae4f823f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
12 deletions
+25
-12
Expr.php
lib/Doctrine/ORM/Query/Expr.php
+6
-6
From.php
lib/Doctrine/ORM/Query/Expr/From.php
+2
-2
QueryBuilder.php
lib/Doctrine/ORM/QueryBuilder.php
+3
-3
EntityManagerTest.php
tests/Doctrine/Tests/ORM/EntityManagerTest.php
+14
-0
ExprTest.php
tests/Doctrine/Tests/ORM/Query/ExprTest.php
+0
-1
No files found.
lib/Doctrine/ORM/Query/Expr.php
View file @
0a7727e1
...
...
@@ -93,10 +93,10 @@ class Expr
* $q->from($q->expr()->from('User', 'u'));
*
* @param string $from Entity name.
* @param string $alias
Optional a
lias to be used by Entity.
* @param string $alias
A
lias to be used by Entity.
* @return Expr\From
*/
public
function
from
(
$from
,
$alias
=
null
)
public
function
from
(
$from
,
$alias
)
{
return
new
Expr\From
(
$from
,
$alias
);
}
...
...
@@ -109,13 +109,13 @@ class Expr
* $q->expr()->leftJoin('u.Group', 'g', 'WITH', "g.name = 'admin'")
*
* @param string $join Relation join.
* @param string $alias
Optional a
lias to be used by Relation.
* @param string $alias
A
lias to be used by Relation.
* @param string $conditionType Optional type of condition appender. Accepts either string or constant.
* 'ON' and 'WITH' are supported strings. Expr\Join::ON and Expr\Join::WITH are supported constants.
* @param mixed $condition Optional condition to be appended.
* @return Expr\Join
*/
public
function
leftJoin
(
$join
,
$alias
=
null
,
$conditionType
=
null
,
$condition
=
null
)
public
function
leftJoin
(
$join
,
$alias
,
$conditionType
=
null
,
$condition
=
null
)
{
return
new
Expr\Join
(
Expr\Join
::
LEFT_JOIN
,
$join
,
$alias
,
$conditionType
,
$condition
);
}
...
...
@@ -128,13 +128,13 @@ class Expr
* $q->expr()->innerJoin('u.Group', 'g', 'WITH', "g.name = 'admin'")
*
* @param string $join Relation join.
* @param string $alias
Optional a
lias to be used by Relation.
* @param string $alias
A
lias to be used by Relation.
* @param string $conditionType Optional type of condition appender. Accepts either string or constant.
* 'ON' and 'WITH' are supported strings. Expr\Join::ON and Expr\Join::WITH are supported constants.
* @param mixed $condition Optional condition to be appended.
* @return Expr\Join
*/
public
function
innerJoin
(
$join
,
$alias
=
null
,
$conditionType
=
null
,
$condition
=
null
)
public
function
innerJoin
(
$join
,
$alias
,
$conditionType
=
null
,
$condition
=
null
)
{
return
new
Expr\Join
(
Expr\Join
::
INNER_JOIN
,
$join
,
$alias
,
$conditionType
,
$condition
);
}
...
...
lib/Doctrine/ORM/Query/Expr/From.php
View file @
0a7727e1
...
...
@@ -37,7 +37,7 @@ class From
private
$_from
;
private
$_alias
;
public
function
__construct
(
$from
,
$alias
=
null
)
public
function
__construct
(
$from
,
$alias
)
{
$this
->
_from
=
$from
;
$this
->
_alias
=
$alias
;
...
...
@@ -55,6 +55,6 @@ class From
public
function
__toString
()
{
return
$this
->
_from
.
(
$this
->
_alias
?
' '
.
$this
->
_alias
:
''
)
;
return
$this
->
_from
.
' '
.
$this
->
_alias
;
}
}
\ No newline at end of file
lib/Doctrine/ORM/QueryBuilder.php
View file @
0a7727e1
...
...
@@ -495,7 +495,7 @@ class QueryBuilder
* @param string $alias The alias of the model
* @return QueryBuilder $qb
*/
public
function
from
(
$from
,
$alias
=
null
)
public
function
from
(
$from
,
$alias
)
{
return
$this
->
add
(
'from'
,
new
Expr\From
(
$from
,
$alias
),
true
);
}
...
...
@@ -515,7 +515,7 @@ class QueryBuilder
* @param string $condition The condition for the join
* @return QueryBuilder $qb
*/
public
function
innerJoin
(
$join
,
$alias
=
null
,
$conditionType
=
null
,
$condition
=
null
)
public
function
innerJoin
(
$join
,
$alias
,
$conditionType
=
null
,
$condition
=
null
)
{
return
$this
->
add
(
'join'
,
new
Expr\Join
(
Expr\Join
::
INNER_JOIN
,
$join
,
$alias
,
$conditionType
,
$condition
...
...
@@ -537,7 +537,7 @@ class QueryBuilder
* @param string $condition The condition for the join
* @return QueryBuilder $qb
*/
public
function
leftJoin
(
$join
,
$alias
=
null
,
$conditionType
=
null
,
$condition
=
null
)
public
function
leftJoin
(
$join
,
$alias
,
$conditionType
=
null
,
$condition
=
null
)
{
return
$this
->
add
(
'join'
,
new
Expr\Join
(
Expr\Join
::
LEFT_JOIN
,
$join
,
$alias
,
$conditionType
,
$condition
...
...
tests/Doctrine/Tests/ORM/EntityManagerTest.php
View file @
0a7727e1
...
...
@@ -71,6 +71,20 @@ class EntityManagerTest extends \Doctrine\Tests\OrmTestCase
{
$this
->
assertType
(
'\Doctrine\ORM\QueryBuilder'
,
$this
->
_em
->
createQueryBuilder
());
}
public
function
testCreateQueryBuilderAliasValid
()
{
$q
=
$this
->
_em
->
createQueryBuilder
()
->
select
(
'u'
)
->
from
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'u'
);
$q2
=
clone
$q
;
$this
->
assertEquals
(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u'
,
$q
->
getQuery
()
->
getDql
());
$this
->
assertEquals
(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u'
,
$q2
->
getQuery
()
->
getDql
());
$q3
=
clone
$q
;
$this
->
assertEquals
(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u'
,
$q3
->
getQuery
()
->
getDql
());
}
public
function
testCreateQuery_DqlIsOptional
()
{
...
...
tests/Doctrine/Tests/ORM/Query/ExprTest.php
View file @
0a7727e1
...
...
@@ -278,7 +278,6 @@ class ExprTest extends \Doctrine\Tests\OrmTestCase
public
function
testFromExpr
()
{
$this
->
assertEquals
(
'User'
,
(
string
)
$this
->
_expr
->
from
(
'User'
));
$this
->
assertEquals
(
'User u'
,
(
string
)
$this
->
_expr
->
from
(
'User'
,
'u'
));
}
...
...
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