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
efca7941
Commit
efca7941
authored
Aug 21, 2008
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DQL Parser refactorings and enhancements. Finished basic drat of Join support.
parent
d8b76a54
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
320 additions
and
459 deletions
+320
-459
Entity.php
lib/Doctrine/Entity.php
+38
-38
AbstractResult.php
lib/Doctrine/Query/AbstractResult.php
+1
-1
Parser.php
lib/Doctrine/Query/Parser.php
+3
-1
BetweenExpression.php
lib/Doctrine/Query/Production/BetweenExpression.php
+6
-16
ComparisonExpression.php
lib/Doctrine/Query/Production/ComparisonExpression.php
+7
-15
ComparisonOperator.php
lib/Doctrine/Query/Production/ComparisonOperator.php
+1
-10
ConditionalExpression.php
lib/Doctrine/Query/Production/ConditionalExpression.php
+2
-15
ConditionalFactor.php
lib/Doctrine/Query/Production/ConditionalFactor.php
+2
-13
ConditionalPrimary.php
lib/Doctrine/Query/Production/ConditionalPrimary.php
+5
-4
ConditionalTerm.php
lib/Doctrine/Query/Production/ConditionalTerm.php
+2
-15
ExistsExpression.php
lib/Doctrine/Query/Production/ExistsExpression.php
+2
-13
Expression.php
lib/Doctrine/Query/Production/Expression.php
+2
-15
FieldIdentificationVariable.php
...Doctrine/Query/Production/FieldIdentificationVariable.php
+5
-13
FromClause.php
lib/Doctrine/Query/Production/FromClause.php
+2
-15
IdentificationVariable.php
lib/Doctrine/Query/Production/IdentificationVariable.php
+0
-17
IdentificationVariableDeclaration.php
...ne/Query/Production/IdentificationVariableDeclaration.php
+15
-52
InExpression.php
lib/Doctrine/Query/Production/InExpression.php
+6
-21
IndexBy.php
lib/Doctrine/Query/Production/IndexBy.php
+5
-14
Join.php
lib/Doctrine/Query/Production/Join.php
+49
-16
JoinVariableDeclaration.php
lib/Doctrine/Query/Production/JoinVariableDeclaration.php
+70
-0
LikeExpression.php
lib/Doctrine/Query/Production/LikeExpression.php
+6
-15
NullComparisonExpression.php
lib/Doctrine/Query/Production/NullComparisonExpression.php
+2
-12
PathExpressionEndingWithAsterisk.php
...ine/Query/Production/PathExpressionEndingWithAsterisk.php
+4
-13
QuantifiedExpression.php
lib/Doctrine/Query/Production/QuantifiedExpression.php
+4
-14
RangeVariableDeclaration.php
lib/Doctrine/Query/Production/RangeVariableDeclaration.php
+28
-26
SelectClause.php
lib/Doctrine/Query/Production/SelectClause.php
+4
-16
SelectExpression.php
lib/Doctrine/Query/Production/SelectExpression.php
+19
-0
SelectStatement.php
lib/Doctrine/Query/Production/SelectStatement.php
+12
-31
SimpleConditionalExpression.php
...Doctrine/Query/Production/SimpleConditionalExpression.php
+4
-15
WhereClause.php
lib/Doctrine/Query/Production/WhereClause.php
+2
-11
SqlBuilder.php
lib/Doctrine/Query/SqlBuilder.php
+1
-1
query-language.txt
query-language.txt
+2
-1
SelectSqlGenerationTest.php
tests/Orm/Query/SelectSqlGenerationTest.php
+9
-0
No files found.
lib/Doctrine/Entity.php
View file @
efca7941
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
/**
/**
* Base class for all Entities (objects with persistent state in a RDBMS that are
* Base class for all Entities (objects with persistent state in a RDBMS that are
* managed by Doctrine). Kind of a Layer Sup
t
ertype.
* managed by Doctrine). Kind of a Layer Supertype.
*
*
* NOTE: Methods that are intended for internal use only but must be public
* NOTE: Methods that are intended for internal use only but must be public
* are marked INTERNAL: and begin with an underscore "_" to indicate that they
* are marked INTERNAL: and begin with an underscore "_" to indicate that they
...
@@ -126,14 +126,14 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -126,14 +126,14 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
/**
/**
* The values that make up the ID/primary key of the entity.
* The values that make up the ID/primary key of the entity.
*
*
* @var array
* @var array
*/
*/
private
$_id
=
array
();
private
$_id
=
array
();
/**
/**
* The entity data.
* The entity data.
*
*
* @var array
* @var array
*/
*/
private
$_data
=
array
();
private
$_data
=
array
();
...
@@ -173,7 +173,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -173,7 +173,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
* @var array
* @var array
*/
*/
private
$_references
=
array
();
private
$_references
=
array
();
/**
/**
* The EntityManager that is responsible for the persistent state of the entity.
* The EntityManager that is responsible for the persistent state of the entity.
*
*
...
@@ -185,10 +185,10 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -185,10 +185,10 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
* The object identifier of the object. Each object has a unique identifier
* The object identifier of the object. Each object has a unique identifier
* during script execution.
* during script execution.
*
*
* @var integer
* @var integer
*/
*/
private
$_oid
;
private
$_oid
;
/**
/**
* Flag that indicates whether the entity is dirty.
* Flag that indicates whether the entity is dirty.
* (which means it has local changes)
* (which means it has local changes)
...
@@ -214,11 +214,11 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -214,11 +214,11 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
else
{
}
else
{
$this
->
_state
=
self
::
STATE_NEW
;
$this
->
_state
=
self
::
STATE_NEW
;
}
}
// @todo read from attribute the first time and move this initialization elsewhere.
// @todo read from attribute the first time and move this initialization elsewhere.
self
::
$_useAutoAccessorOverride
=
true
;
self
::
$_useAutoAccessorOverride
=
true
;
}
}
/**
/**
* Returns the object identifier.
* Returns the object identifier.
*
*
...
@@ -295,7 +295,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -295,7 +295,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
}
}
}
}
$str
=
serialize
(
$vars
);
$str
=
serialize
(
$vars
);
//$this->postSerialize($event);
//$this->postSerialize($event);
...
@@ -330,7 +330,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -330,7 +330,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
foreach
(
$array
as
$k
=>
$v
)
{
foreach
(
$array
as
$k
=>
$v
)
{
$this
->
$k
=
$v
;
$this
->
$k
=
$v
;
}
}
$this
->
_class
=
$this
->
_em
->
getClassMetadata
(
$this
->
_entityName
);
$this
->
_class
=
$this
->
_em
->
getClassMetadata
(
$this
->
_entityName
);
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
foreach
(
$this
->
_data
as
$k
=>
$v
)
{
...
@@ -350,7 +350,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -350,7 +350,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
$this
->
_extractIdentifier
(
!
$this
->
isNew
());
$this
->
_extractIdentifier
(
!
$this
->
isNew
());
//$this->postUnserialize($event);
//$this->postUnserialize($event);
}
}
...
@@ -375,7 +375,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -375,7 +375,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
/**
/**
* Gets the current field values.
* Gets the current field values.
*
*
* @return array The fields and their values.
* @return array The fields and their values.
*/
*/
final
public
function
getData
()
final
public
function
getData
()
{
{
...
@@ -390,7 +390,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -390,7 +390,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
* @throws Doctrine::ORM::Exceptions::EntityException If trying to get an unknown field.
* @throws Doctrine::ORM::Exceptions::EntityException If trying to get an unknown field.
*/
*/
final
protected
function
_get
(
$fieldName
)
final
protected
function
_get
(
$fieldName
)
{
{
$nullObj
=
Doctrine_Null
::
$INSTANCE
;
$nullObj
=
Doctrine_Null
::
$INSTANCE
;
if
(
isset
(
$this
->
_data
[
$fieldName
]))
{
if
(
isset
(
$this
->
_data
[
$fieldName
]))
{
return
$this
->
_data
[
$fieldName
]
!==
$nullObj
?
return
$this
->
_data
[
$fieldName
]
!==
$nullObj
?
...
@@ -415,7 +415,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -415,7 +415,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
}
}
}
}
/**
/**
* Sets the value of a field (regular field or reference).
* Sets the value of a field (regular field or reference).
*
*
...
@@ -455,7 +455,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -455,7 +455,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
throw
Doctrine_Entity_Exception
::
invalidField
(
$fieldName
);
throw
Doctrine_Entity_Exception
::
invalidField
(
$fieldName
);
}
}
}
}
private
function
_registerDirty
()
private
function
_registerDirty
()
{
{
if
(
$this
->
_state
==
self
::
STATE_MANAGED
&&
if
(
$this
->
_state
==
self
::
STATE_MANAGED
&&
...
@@ -463,7 +463,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -463,7 +463,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
$this
->
_em
->
getUnitOfWork
()
->
registerDirty
(
$this
);
$this
->
_em
->
getUnitOfWork
()
->
registerDirty
(
$this
);
}
}
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Gets the value of a field.
* Gets the value of a field.
...
@@ -482,7 +482,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -482,7 +482,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
return
$this
->
_data
[
$fieldName
];
return
$this
->
_data
[
$fieldName
];
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Sets the value of a field.
* Sets the value of a field.
...
@@ -498,7 +498,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -498,7 +498,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
$this
->
_data
[
$fieldName
]
=
$value
;
$this
->
_data
[
$fieldName
]
=
$value
;
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Gets a reference to another Entity.
* Gets a reference to another Entity.
...
@@ -515,7 +515,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -515,7 +515,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
return
$this
->
_references
[
$fieldName
];
return
$this
->
_references
[
$fieldName
];
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Sets a reference to another entity or a collection of entities.
* Sets a reference to another entity or a collection of entities.
...
@@ -532,7 +532,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -532,7 +532,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
$this
->
_references
[
$name
]
=
$value
;
$this
->
_references
[
$name
]
=
$value
;
return
;
return
;
}
}
$rel
=
$this
->
_class
->
getRelation
(
$name
);
$rel
=
$this
->
_class
->
getRelation
(
$name
);
// one-to-many or one-to-one relation
// one-to-many or one-to-one relation
...
@@ -575,7 +575,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -575,7 +575,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
$this
->
_references
[
$name
]
=
$value
;
$this
->
_references
[
$name
]
=
$value
;
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Sets a reference to another entity or a collection of entities.
* Sets a reference to another entity or a collection of entities.
...
@@ -592,7 +592,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -592,7 +592,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
$this
->
_references
[
$name
]
=
$value
;
$this
->
_references
[
$name
]
=
$value
;
return
;
return
;
}
}
$rel
=
$this
->
_class
->
getAssociationMapping
(
$name
);
$rel
=
$this
->
_class
->
getAssociationMapping
(
$name
);
// one-to-many or one-to-one relation
// one-to-many or one-to-one relation
...
@@ -641,7 +641,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -641,7 +641,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
return
$this
->
_get
(
$fieldName
);
return
$this
->
_get
(
$fieldName
);
}
}
/**
/**
* Gets the custom mutator method for a field, if it exists.
* Gets the custom mutator method for a field, if it exists.
*
*
...
@@ -660,17 +660,17 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -660,17 +660,17 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
}
}
}
}
if
(
$setter
=
$this
->
_class
->
getCustomMutator
(
$fieldName
))
{
if
(
$setter
=
$this
->
_class
->
getCustomMutator
(
$fieldName
))
{
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
$setter
;
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
$setter
;
}
else
if
(
!
isset
(
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]))
{
}
else
if
(
!
isset
(
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]))
{
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
}
}
}
}
return
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
];
return
self
::
$_mutatorCache
[
$this
->
_entityName
][
$fieldName
];
}
}
/**
/**
* Gets the custom accessor method of a field, if it exists.
* Gets the custom accessor method of a field, if it exists.
*
*
...
@@ -695,10 +695,10 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -695,10 +695,10 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
self
::
$_accessorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
self
::
$_accessorCache
[
$this
->
_entityName
][
$fieldName
]
=
false
;
}
}
}
}
return
self
::
$_accessorCache
[
$this
->
_entityName
][
$fieldName
];
return
self
::
$_accessorCache
[
$this
->
_entityName
][
$fieldName
];
}
}
/**
/**
* Gets the entity class name.
* Gets the entity class name.
*
*
...
@@ -773,7 +773,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -773,7 +773,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
}
}
}
}
}
}
/**
/**
* INTERNAL:
* INTERNAL:
* Gets the changeset of the entities persistent state.
* Gets the changeset of the entities persistent state.
...
@@ -784,12 +784,12 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -784,12 +784,12 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
$this
->
_dataChangeSet
;
return
$this
->
_dataChangeSet
;
}
}
final
public
function
_getReferenceChangeSet
()
final
public
function
_getReferenceChangeSet
()
{
{
return
$this
->
_referenceChangeSet
;
return
$this
->
_referenceChangeSet
;
}
}
/**
/**
* Checks whether the entity already has a persistent state.
* Checks whether the entity already has a persistent state.
*
*
...
@@ -893,7 +893,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -893,7 +893,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
$this
->
_references
[
$alias
]
=
$coll
;
$this
->
_references
[
$alias
]
=
$coll
;
}
}
/**
/**
* Gets the ClassMetadata object that describes the entity class.
* Gets the ClassMetadata object that describes the entity class.
*
*
...
@@ -903,7 +903,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -903,7 +903,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
$this
->
_class
;
return
$this
->
_class
;
}
}
/**
/**
* Gets the EntityManager that is responsible for the persistence of
* Gets the EntityManager that is responsible for the persistence of
* the entity.
* the entity.
...
@@ -914,7 +914,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -914,7 +914,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
$this
->
_em
;
return
$this
->
_em
;
}
}
/**
/**
* Gets the EntityRepository of the Entity.
* Gets the EntityRepository of the Entity.
*
*
...
@@ -924,7 +924,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -924,7 +924,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
$this
->
_em
->
getRepository
(
$this
->
_entityName
);
return
$this
->
_em
->
getRepository
(
$this
->
_entityName
);
}
}
/**
/**
* @todo Why toString() and __toString() ?
* @todo Why toString() and __toString() ?
*/
*/
...
@@ -941,7 +941,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -941,7 +941,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
(
string
)
$this
->
_oid
;
return
(
string
)
$this
->
_oid
;
}
}
/**
/**
* Helps freeing the memory occupied by the entity.
* Helps freeing the memory occupied by the entity.
* Cuts all references the entity has to other entities and removes the entity
* Cuts all references the entity has to other entities and removes the entity
...
@@ -969,7 +969,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -969,7 +969,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
$this
->
_references
=
array
();
$this
->
_references
=
array
();
}
}
}
}
/**
/**
* Check if an offsetExists.
* Check if an offsetExists.
*
*
...
@@ -1022,7 +1022,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
...
@@ -1022,7 +1022,7 @@ abstract class Doctrine_Entity implements ArrayAccess, Serializable
{
{
return
$this
->
remove
(
$offset
);
return
$this
->
remove
(
$offset
);
}
}
/**
/**
* __set
* __set
*
*
...
...
lib/Doctrine/Query/AbstractResult.php
View file @
efca7941
...
@@ -123,7 +123,7 @@ abstract class Doctrine_Query_AbstractResult
...
@@ -123,7 +123,7 @@ abstract class Doctrine_Query_AbstractResult
*/
*/
public
function
getQueryComponent
(
$componentAlias
)
public
function
getQueryComponent
(
$componentAlias
)
{
{
if
(
!
isset
(
$this
->
_queryComponents
[
$componentAlias
]
))
{
if
(
!
array_key_exists
(
$componentAlias
,
$this
->
_queryComponents
))
{
throw
new
Doctrine_Query_Exception
(
'Unknown query component '
.
$componentAlias
);
throw
new
Doctrine_Query_Exception
(
'Unknown query component '
.
$componentAlias
);
}
}
...
...
lib/Doctrine/Query/Parser.php
View file @
efca7941
...
@@ -173,7 +173,9 @@ class Doctrine_Query_Parser
...
@@ -173,7 +173,9 @@ class Doctrine_Query_Parser
/**
/**
* @todo [TODO] Document these!
* Moves the parser scanner to next token
*
* @return void
*/
*/
public
function
next
()
public
function
next
()
{
{
...
...
lib/Doctrine/Query/Production/BetweenExpression.php
View file @
efca7941
...
@@ -65,31 +65,21 @@ class Doctrine_Query_Production_BetweenExpression extends Doctrine_Query_Product
...
@@ -65,31 +65,21 @@ class Doctrine_Query_Production_BetweenExpression extends Doctrine_Query_Product
return
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'BETWEEN '
return
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'BETWEEN '
.
$this
->
_fromExpression
->
buildSql
()
.
' AND '
.
$this
->
_toExpression
->
buildSql
();
.
$this
->
_fromExpression
->
buildSql
()
.
' AND '
.
$this
->
_toExpression
->
buildSql
();
}
}
/**
* Visitor support.
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_fromExpression
->
accept
(
$visitor
);
$this
->
_toExpression
->
accept
(
$visitor
);
$visitor
->
visitBetweenExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
isNot
()
public
function
isNot
()
{
{
return
$this
->
_not
;
return
$this
->
_not
;
}
}
public
function
getFromExpression
()
public
function
getFromExpression
()
{
{
return
$this
->
_fromExpression
;
return
$this
->
_fromExpression
;
}
}
public
function
getToExpression
()
public
function
getToExpression
()
{
{
return
$this
->
_toExpression
;
return
$this
->
_toExpression
;
...
...
lib/Doctrine/Query/Production/ComparisonExpression.php
View file @
efca7941
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @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 http://www.phpdoctrine.org
...
@@ -71,30 +72,21 @@ class Doctrine_Query_Production_ComparisonExpression extends Doctrine_Query_Prod
...
@@ -71,30 +72,21 @@ class Doctrine_Query_Production_ComparisonExpression extends Doctrine_Query_Prod
'('
.
$this
->
_expression
->
buildSql
()
.
')'
:
$this
->
_expression
->
buildSql
()
'('
.
$this
->
_expression
->
buildSql
()
.
')'
:
$this
->
_expression
->
buildSql
()
);
);
}
}
/**
* Visitor support.
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_expression
->
accept
(
$visitor
);
$visitor
->
visitComparisonExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getOperator
()
public
function
getOperator
()
{
{
return
$this
->
_operator
;
return
$this
->
_operator
;
}
}
public
function
getExpression
()
public
function
getExpression
()
{
{
return
$this
->
_expression
;
return
$this
->
_expression
;
}
}
public
function
isSubselect
()
public
function
isSubselect
()
{
{
return
$this
->
_isSubselect
;
return
$this
->
_isSubselect
;
...
...
lib/Doctrine/Query/Production/ComparisonOperator.php
View file @
efca7941
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @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 http://www.phpdoctrine.org
...
@@ -78,14 +79,4 @@ class Doctrine_Query_Production_ComparisonOperator extends Doctrine_Query_Produc
...
@@ -78,14 +79,4 @@ class Doctrine_Query_Production_ComparisonOperator extends Doctrine_Query_Produc
break
;
break
;
}
}
}
}
/**
* Visitor support.
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitComparisonOperator
(
$this
);
}
}
}
lib/Doctrine/Query/Production/ConditionalExpression.php
View file @
efca7941
...
@@ -69,22 +69,9 @@ class Doctrine_Query_Production_ConditionalExpression extends Doctrine_Query_Pro
...
@@ -69,22 +69,9 @@ class Doctrine_Query_Production_ConditionalExpression extends Doctrine_Query_Pro
{
{
return
$value
->
buildSql
();
return
$value
->
buildSql
();
}
}
/**
* Visitor support.
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
foreach
(
$this
->
_conditionalTerms
as
$term
)
{
$term
->
accept
(
$visitor
);
}
$visitor
->
visitConditionalExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getConditionalTerms
()
public
function
getConditionalTerms
()
{
{
return
$this
->
_conditionalTerms
;
return
$this
->
_conditionalTerms
;
...
...
lib/Doctrine/Query/Production/ConditionalFactor.php
View file @
efca7941
...
@@ -60,20 +60,9 @@ class Doctrine_Query_Production_ConditionalFactor extends Doctrine_Query_Product
...
@@ -60,20 +60,9 @@ class Doctrine_Query_Production_ConditionalFactor extends Doctrine_Query_Product
// Do not need to check $notFactor. It'll be always present if we have this instance.
// Do not need to check $notFactor. It'll be always present if we have this instance.
return
'NOT '
.
$this
->
_conditionalPrimary
->
buildSql
();
return
'NOT '
.
$this
->
_conditionalPrimary
->
buildSql
();
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_conditionalPrimary
->
accept
(
$visitor
);
$visitor
->
visitConditionalFactor
(
$this
);
}
/* Getters */
/* Getters */
public
function
getConditionalPrimary
()
public
function
getConditionalPrimary
()
{
{
return
$this
->
_conditionalPrimary
;
return
$this
->
_conditionalPrimary
;
...
...
lib/Doctrine/Query/Production/ConditionalPrimary.php
View file @
efca7941
...
@@ -98,10 +98,11 @@ class Doctrine_Query_Production_ConditionalPrimary extends Doctrine_Query_Produc
...
@@ -98,10 +98,11 @@ class Doctrine_Query_Production_ConditionalPrimary extends Doctrine_Query_Produc
return
false
;
return
false
;
}
}
public
function
accept
(
$visitor
)
/* Getters */
public
function
getConditionalExpression
()
{
{
$this
->
_conditionalExpression
->
accept
(
$visitor
);
return
$this
->
_conditionalExpression
;
$visitor
->
visitConditionalPrimary
(
$this
);
}
}
}
}
lib/Doctrine/Query/Production/ConditionalTerm.php
View file @
efca7941
...
@@ -69,22 +69,9 @@ class Doctrine_Query_Production_ConditionalTerm extends Doctrine_Query_Productio
...
@@ -69,22 +69,9 @@ class Doctrine_Query_Production_ConditionalTerm extends Doctrine_Query_Productio
{
{
return
$value
->
buildSql
();
return
$value
->
buildSql
();
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
foreach
(
$this
->
_conditionalFactors
as
$factor
)
{
$factor
->
accept
(
$visitor
);
}
$visitor
->
visitConditionalTerm
(
$this
);
}
/* Getters */
/* Getters */
public
function
getConditionalFactors
()
public
function
getConditionalFactors
()
{
{
return
$this
->
_conditionalFactors
;
return
$this
->
_conditionalFactors
;
...
...
lib/Doctrine/Query/Production/ExistsExpression.php
View file @
efca7941
...
@@ -51,20 +51,9 @@ class Doctrine_Query_Production_ExistsExpression extends Doctrine_Query_Producti
...
@@ -51,20 +51,9 @@ class Doctrine_Query_Production_ExistsExpression extends Doctrine_Query_Producti
{
{
return
'EXISTS ('
.
$this
->
_subselect
->
buildSql
()
.
')'
;
return
'EXISTS ('
.
$this
->
_subselect
->
buildSql
()
.
')'
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_subselect
->
accept
(
$visitor
);
$visitor
->
visitExistsExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getSubselect
()
public
function
getSubselect
()
{
{
return
$this
->
_subselect
;
return
$this
->
_subselect
;
...
...
lib/Doctrine/Query/Production/Expression.php
View file @
efca7941
...
@@ -86,22 +86,9 @@ class Doctrine_Query_Production_Expression extends Doctrine_Query_Production
...
@@ -86,22 +86,9 @@ class Doctrine_Query_Production_Expression extends Doctrine_Query_Production
{
{
return
(
is_string
(
$value
)
?
$value
:
$value
->
buildSql
());
return
(
is_string
(
$value
)
?
$value
:
$value
->
buildSql
());
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
foreach
(
$this
->
_terms
as
$term
)
{
$term
->
accept
(
$visitor
);
}
$visitor
->
visitExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getTerms
()
public
function
getTerms
()
{
{
return
$this
->
_terms
;
return
$this
->
_terms
;
...
...
lib/Doctrine/Query/Production/FieldIdentificationVariable.php
View file @
efca7941
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @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 http://www.phpdoctrine.org
...
@@ -74,24 +75,15 @@ class Doctrine_Query_Production_FieldIdentificationVariable extends Doctrine_Que
...
@@ -74,24 +75,15 @@ class Doctrine_Query_Production_FieldIdentificationVariable extends Doctrine_Que
$this
->
_columnAlias
=
$parserResult
->
getTableAliasFromComponentAlias
(
$componentAlias
)
$this
->
_columnAlias
=
$parserResult
->
getTableAliasFromComponentAlias
(
$componentAlias
)
.
Doctrine_Query_Production
::
SQLALIAS_SEPARATOR
.
$idx
;
.
Doctrine_Query_Production
::
SQLALIAS_SEPARATOR
.
$idx
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitFieldIdentificationVariable
(
$this
);
}
/* Getters */
/* Getters */
public
function
getFieldAlias
()
public
function
getFieldAlias
()
{
{
return
$this
->
_fieldAlias
;
return
$this
->
_fieldAlias
;
}
}
public
function
getColumnAlias
()
public
function
getColumnAlias
()
{
{
return
$this
->
_columnAlias
;
return
$this
->
_columnAlias
;
...
...
lib/Doctrine/Query/Production/FromClause.php
View file @
efca7941
...
@@ -71,22 +71,9 @@ class Doctrine_Query_Production_FromClause extends Doctrine_Query_Production
...
@@ -71,22 +71,9 @@ class Doctrine_Query_Production_FromClause extends Doctrine_Query_Production
{
{
return
$value
->
buildSql
();
return
$value
->
buildSql
();
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
foreach
(
$this
->
_identificationVariableDeclaration
as
$decl
)
{
$decl
->
accept
(
$visitor
);
}
$visitor
->
visitFromClause
(
$this
);
}
/* Getters */
/* Getters */
public
function
getIdentificationVariableDeclarations
()
public
function
getIdentificationVariableDeclarations
()
{
{
return
$this
->
_identificationVariableDeclaration
;
return
$this
->
_identificationVariableDeclaration
;
...
...
lib/Doctrine/Query/Production/IdentificationVariable.php
View file @
efca7941
...
@@ -62,21 +62,4 @@ class Doctrine_Query_Production_IdentificationVariable extends Doctrine_Query_Pr
...
@@ -62,21 +62,4 @@ class Doctrine_Query_Production_IdentificationVariable extends Doctrine_Query_Pr
return
$this
->
_componentAlias
;
return
$this
->
_componentAlias
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitIdentificationVariable
(
$this
);
}
/* Getters */
public
function
getComponentAlias
()
{
return
$this
->
_componentAlias
;
}
}
}
lib/Doctrine/Query/Production/IdentificationVariableDeclaration.php
View file @
efca7941
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
*/
*/
/**
/**
* IdentificationVariableDeclaration = RangeVariableDeclaration [IndexBy] {Join
[IndexBy]
}
* IdentificationVariableDeclaration = RangeVariableDeclaration [IndexBy] {Join
VariableDeclaration
}
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
...
@@ -37,7 +37,7 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
...
@@ -37,7 +37,7 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
protected
$_indexBy
;
protected
$_indexBy
;
protected
$_
rel
ations
=
array
();
protected
$_
joinVariableDeclar
ations
=
array
();
public
function
syntax
(
$paramHolder
)
public
function
syntax
(
$paramHolder
)
...
@@ -45,7 +45,7 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
...
@@ -45,7 +45,7 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
$this
->
_rangeVariableDeclaration
=
$this
->
AST
(
'RangeVariableDeclaration'
,
$paramHolder
);
$this
->
_rangeVariableDeclaration
=
$this
->
AST
(
'RangeVariableDeclaration'
,
$paramHolder
);
if
(
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INDEX
))
{
if
(
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INDEX
))
{
$paramHolder
->
set
(
'componentAlias'
,
$this
->
_rangeVariableDeclaration
);
$paramHolder
->
set
(
'componentAlias'
,
$this
->
_rangeVariableDeclaration
->
getIdentificationVariable
()
);
$this
->
_indexBy
=
$this
->
AST
(
'IndexBy'
,
$paramHolder
);
$this
->
_indexBy
=
$this
->
AST
(
'IndexBy'
,
$paramHolder
);
$paramHolder
->
remove
(
'componentAlias'
);
$paramHolder
->
remove
(
'componentAlias'
);
}
}
...
@@ -55,75 +55,38 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
...
@@ -55,75 +55,38 @@ class Doctrine_Query_Production_IdentificationVariableDeclaration extends Doctri
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INNER
)
||
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INNER
)
||
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_JOIN
)
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_JOIN
)
)
{
)
{
$i
=
count
(
$this
->
_relations
);
$this
->
_joinVariableDeclarations
[]
=
$this
->
AST
(
'JoinVariableDeclaration'
,
$paramHolder
);
$this
->
_relations
[
$i
][
'join'
]
=
$this
->
AST
(
'Join'
,
$paramHolder
);
if
(
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INDEX
))
{
$paramHolder
->
set
(
'componentAlias'
,
$this
->
_relations
[
$i
][
'join'
]
->
getRangeVariableDeclaration
());
$this
->
_relations
[
$i
][
'indexBy'
]
=
$this
->
AST
(
'IndexBy'
,
$paramHolder
);
$paramHolder
->
remove
(
'componentAlias'
);
}
}
}
}
}
public
function
buildSql
()
public
function
buildSql
()
{
{
// We need to bring the queryComponent and get things from there.
$str
=
$this
->
_rangeVariableDeclaration
->
buildSql
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
$queryComponent
=
$parserResult
->
getQueryComponent
(
$this
->
_rangeVariableDeclaration
);
// Retrieving connection
$conn
=
$this
->
_em
->
getConnection
();
$str
=
$conn
->
quoteIdentifier
(
$queryComponent
[
'metadata'
]
->
getTableName
())
.
' '
.
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$this
->
_rangeVariableDeclaration
));
for
(
$i
=
0
,
$l
=
count
(
$this
->
_relations
);
$i
<
$l
;
$i
++
)
{
for
(
$i
=
0
,
$l
=
count
(
$this
->
_joinVariableDeclarations
);
$i
<
$l
;
$i
++
)
{
$str
.=
$this
->
_relations
[
$i
][
'join'
]
->
buildSql
()
.
' '
$str
.=
' '
.
$this
->
_joinVariableDeclarations
[
$i
]
->
buildSql
();
.
((
isset
(
$this
->
_relations
[
$i
][
'indexby'
]))
?
$this
->
_relations
[
$i
][
'indexby'
]
->
buildSql
()
.
' '
:
''
);
}
}
return
$str
;
return
$str
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_rangeVariableDeclaration
->
accept
(
$visitor
);
if
(
$this
->
_indexBy
)
{
$this
->
_indexBy
->
accept
(
$visitor
);
}
foreach
(
$this
->
_relations
as
$relation
)
{
if
(
$relation
[
'join'
])
{
$relation
[
'join'
]
->
accept
(
$visitor
);
}
if
(
$relation
[
'indexby'
])
{
$relation
[
'indexby'
]
->
accept
(
$visitor
);
}
}
$visitor
->
visitIdentificationVariable
(
$this
);
}
/* Getters */
/* Getters */
public
function
getRangeVariableDeclaration
()
public
function
getRangeVariableDeclaration
()
{
{
return
$this
->
_rangeVariableDeclaration
;
return
$this
->
_rangeVariableDeclaration
;
}
}
public
function
getIndexBy
()
public
function
getIndexBy
()
{
{
return
$this
->
_indexBy
;
return
$this
->
_indexBy
;
}
}
public
function
getRelations
()
public
function
getJoinVariableDeclarations
()
{
{
return
$this
->
_
rel
ations
;
return
$this
->
_
joinVariableDeclar
ations
;
}
}
}
}
lib/Doctrine/Query/Production/InExpression.php
View file @
efca7941
...
@@ -87,36 +87,21 @@ class Doctrine_Query_Production_InExpression extends Doctrine_Query_Production
...
@@ -87,36 +87,21 @@ class Doctrine_Query_Production_InExpression extends Doctrine_Query_Production
{
{
return
$value
->
buildSql
();
return
$value
->
buildSql
();
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
if
(
$this
->
_subselect
!==
null
)
{
$this
->
_subselect
->
accept
(
$visitor
);
}
else
{
foreach
(
$this
->
_atoms
as
$atom
)
{
$atom
->
accept
(
$visitor
);
}
}
$visitor
->
visitInExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
isNot
()
public
function
isNot
()
{
{
return
$this
->
_not
;
return
$this
->
_not
;
}
}
public
function
getSubselect
()
public
function
getSubselect
()
{
{
return
$this
->
_subselect
;
return
$this
->
_subselect
;
}
}
public
function
getAtoms
()
public
function
getAtoms
()
{
{
return
$this
->
_atoms
;
return
$this
->
_atoms
;
...
...
lib/Doctrine/Query/Production/IndexBy.php
View file @
efca7941
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @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 http://www.phpdoctrine.org
...
@@ -95,7 +96,6 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
...
@@ -95,7 +96,6 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
);
);
}
}
$queryComponent
[
'map'
]
=
$this
->
_fieldName
;
$queryComponent
[
'map'
]
=
$this
->
_fieldName
;
$parserResult
->
setQueryComponent
(
$this
->
_componentAlias
,
$queryComponent
);
$parserResult
->
setQueryComponent
(
$this
->
_componentAlias
,
$queryComponent
);
}
}
...
@@ -105,24 +105,15 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
...
@@ -105,24 +105,15 @@ class Doctrine_Query_Production_IndexBy extends Doctrine_Query_Production
{
{
return
''
;
return
''
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitIndexBy
(
$this
);
}
/* Getters */
/* Getters */
public
function
getComponentAlias
()
public
function
getComponentAlias
()
{
{
return
$this
->
_componentAlias
;
return
$this
->
_componentAlias
;
}
}
public
function
getFieldName
()
public
function
getFieldName
()
{
{
return
$this
->
_fieldName
;
return
$this
->
_fieldName
;
...
...
lib/Doctrine/Query/Production/Join.php
View file @
efca7941
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
*
*
* @package Doctrine
* @package Doctrine
* @subpackage Query
* @subpackage Query
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @author Janne Vanhala <jpvanhal@cc.hut.fi>
* @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 http://www.phpdoctrine.org
...
@@ -74,36 +75,68 @@ class Doctrine_Query_Production_Join extends Doctrine_Query_Production
...
@@ -74,36 +75,68 @@ class Doctrine_Query_Production_Join extends Doctrine_Query_Production
public
function
buildSql
()
public
function
buildSql
()
{
{
return
''
;
$parserResult
=
$this
->
_parser
->
getParserResult
();
}
// Get the connection for the component
/**
$conn
=
$this
->
_em
->
getConnection
();
* Visitor support
*
$sql
=
$this
->
_joinType
.
' JOIN '
.
$this
->
_rangeVariableDeclaration
->
buildSql
();
* @param object $visitor
$conditionExpression
=
isset
(
$this
->
_conditionExpression
)
*/
?
$this
->
_conditionExpression
->
buildSql
()
:
''
;
public
function
accept
(
$visitor
)
{
if
(
$this
->
_whereType
==
'ON'
)
{
$visitor
->
visitJoin
(
$this
);
return
$sql
.
' ON '
.
$conditionExpression
;
}
// We need to build the relationship conditions. Retrieving AssociationMapping
$queryComponent
=
$this
->
_rangeVariableDeclaration
->
getQueryComponent
();
$relationColumns
=
$queryComponent
[
'relation'
]
->
getSourceToTargetKeyColumns
();
$relationConditionExpression
=
''
;
// We have an array('localColumn' => 'foreignColumn', ...) here
foreach
(
$relationColumns
as
$localColumn
=>
$foreignColumn
)
{
// leftExpression = rightExpression
// Defining leftExpression
$leftExpression
=
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$queryComponent
[
'parent'
])
.
'.'
.
$localColumn
);
// Defining rightExpression
$rightExpression
=
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$this
->
_rangeVariableDeclaration
->
getIdentificationVariable
()
)
.
'.'
.
$foreignColumn
);
// Building the relation
$relationConditionExpression
.=
((
$relationConditionExpression
!=
''
)
?
' AND '
:
''
)
.
$leftExpression
.
' = '
.
$rightExpression
;
}
return
$sql
.
' ON '
.
$relationConditionExpression
.
' AND ('
.
$conditionExpression
.
')'
;
}
}
/* Getters */
/* Getters */
public
function
getJoinType
()
public
function
getJoinType
()
{
{
return
$this
->
_joinType
;
return
$this
->
_joinType
;
}
}
public
function
getRangeVariableDeclaration
()
public
function
getRangeVariableDeclaration
()
{
{
return
$this
->
_rangeVariableDeclaration
;
return
$this
->
_rangeVariableDeclaration
;
}
}
public
function
getWhereType
()
public
function
getWhereType
()
{
{
return
$this
->
_whereType
;
return
$this
->
_whereType
;
}
}
public
function
getConditionalExpression
()
public
function
getConditionalExpression
()
{
{
return
$this
->
_conditionalExpression
;
return
$this
->
_conditionalExpression
;
...
...
lib/Doctrine/Query/Production/JoinVariableDeclaration.php
0 → 100755
View file @
efca7941
<?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>.
*/
/**
* JoinVariableDeclaration = Join [IndexBy]
*
* @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
Doctrine_Query_Production_JoinVariableDeclaration
extends
Doctrine_Query_Production
{
protected
$_join
;
protected
$_indexBy
;
public
function
syntax
(
$paramHolder
)
{
$this
->
_join
=
$this
->
AST
(
'Join'
,
$paramHolder
);
if
(
$this
->
_isNextToken
(
Doctrine_Query_Token
::
T_INDEX
))
{
$paramHolder
->
set
(
'componentAlias'
,
$this
->
_join
->
getRangeVariableDeclaration
()
->
getIdentificationVariable
());
$this
->
_indexBy
=
$this
->
AST
(
'IndexBy'
,
$paramHolder
);
$paramHolder
->
remove
(
'componentAlias'
);
}
}
public
function
buildSql
()
{
return
$this
->
_join
->
buildSql
()
.
' '
.
(
isset
(
$this
->
_indexby
)
?
$this
->
_indexby
->
buildSql
()
.
' '
:
''
);
}
/* Getters */
public
function
getJoin
()
{
return
$this
->
_join
;
}
public
function
getIndexBy
()
{
return
$this
->
_indexBy
;
}
}
\ No newline at end of file
lib/Doctrine/Query/Production/LikeExpression.php
View file @
efca7941
...
@@ -69,30 +69,21 @@ class Doctrine_Query_Production_LikeExpression extends Doctrine_Query_Production
...
@@ -69,30 +69,21 @@ class Doctrine_Query_Production_LikeExpression extends Doctrine_Query_Production
return
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'LIKE '
.
$this
->
_expression
->
buildSql
()
return
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'LIKE '
.
$this
->
_expression
->
buildSql
()
.
((
$this
->
_escapeString
!==
null
)
?
' ESCAPE '
.
$this
->
_escapeString
:
''
);
.
((
$this
->
_escapeString
!==
null
)
?
' ESCAPE '
.
$this
->
_escapeString
:
''
);
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_expression
->
accept
(
$visitor
);
$visitor
->
visitLikeExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
isNot
()
public
function
isNot
()
{
{
return
$this
->
_not
;
return
$this
->
_not
;
}
}
public
function
getExpression
()
public
function
getExpression
()
{
{
return
$this
->
_expression
;
return
$this
->
_expression
;
}
}
public
function
getEscapeString
()
public
function
getEscapeString
()
{
{
return
$this
->
_escapeString
;
return
$this
->
_escapeString
;
...
...
lib/Doctrine/Query/Production/NullComparisonExpression.php
View file @
efca7941
...
@@ -55,19 +55,9 @@ class Doctrine_Query_Production_NullComparisonExpression extends Doctrine_Query_
...
@@ -55,19 +55,9 @@ class Doctrine_Query_Production_NullComparisonExpression extends Doctrine_Query_
{
{
return
'IS '
.
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'NULL'
;
return
'IS '
.
((
$this
->
_not
)
?
'NOT '
:
''
)
.
'NULL'
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitNullComparisonExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
isNot
()
public
function
isNot
()
{
{
return
$this
->
_not
;
return
$this
->
_not
;
...
...
lib/Doctrine/Query/Production/PathExpressionEndingWithAsterisk.php
View file @
efca7941
...
@@ -153,24 +153,15 @@ class Doctrine_Query_Production_PathExpressionEndingWithAsterisk extends Doctrin
...
@@ -153,24 +153,15 @@ class Doctrine_Query_Production_PathExpressionEndingWithAsterisk extends Doctrin
return
$str
;
return
$str
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitPathExpressionEndingWithAsterisk
(
$this
);
}
/* Getters */
/* Getters */
public
function
getIdentifiers
()
public
function
getIdentifiers
()
{
{
return
$this
->
_identifiers
;
return
$this
->
_identifiers
;
}
}
public
function
getQueryComponent
()
public
function
getQueryComponent
()
{
{
return
$this
->
_queryComponent
;
return
$this
->
_queryComponent
;
...
...
lib/Doctrine/Query/Production/QuantifiedExpression.php
View file @
efca7941
...
@@ -69,25 +69,15 @@ class Doctrine_Query_Production_QuantifiedExpression extends Doctrine_Query_Prod
...
@@ -69,25 +69,15 @@ class Doctrine_Query_Production_QuantifiedExpression extends Doctrine_Query_Prod
{
{
return
$this
->
_type
.
' ('
.
$this
->
_subselect
->
buildSql
()
.
')'
;
return
$this
->
_type
.
' ('
.
$this
->
_subselect
->
buildSql
()
.
')'
;
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_subselect
->
accept
(
$visitor
);
$visitor
->
visitQuantifiedExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getType
()
public
function
getType
()
{
{
return
$this
->
_type
;
return
$this
->
_type
;
}
}
public
function
getSubselect
()
public
function
getSubselect
()
{
{
return
$this
->
_subselect
;
return
$this
->
_subselect
;
...
...
lib/Doctrine/Query/Production/RangeVariableDeclaration.php
View file @
efca7941
...
@@ -35,6 +35,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -35,6 +35,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
{
{
protected
$_identifiers
=
array
();
protected
$_identifiers
=
array
();
protected
$_queryComponent
;
protected
$_identificationVariable
;
protected
$_identificationVariable
;
...
@@ -99,14 +101,19 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -99,14 +101,19 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
$this
->
_semanticalWithSingleIdentifier
();
$this
->
_semanticalWithSingleIdentifier
();
}
}
}
}
return
$this
->
_identificationVariable
;
}
}
public
function
buildSql
()
public
function
buildSql
()
{
{
return
''
;
// We need to bring the queryComponent and get things from there.
$parserResult
=
$this
->
_parser
->
getParserResult
();
// Retrieving connection
$conn
=
$this
->
_em
->
getConnection
();
return
$conn
->
quoteIdentifier
(
$this
->
_queryComponent
[
'metadata'
]
->
getTableName
())
.
' '
.
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$this
->
_identificationVariable
));
}
}
...
@@ -123,7 +130,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -123,7 +130,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
$componentName
);
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
$componentName
);
// Building queryComponent
// Building queryComponent
$queryComponent
=
array
(
$
this
->
_
queryComponent
=
array
(
'metadata'
=>
$classMetadata
,
'metadata'
=>
$classMetadata
,
'parent'
=>
null
,
'parent'
=>
null
,
'relation'
=>
null
,
'relation'
=>
null
,
...
@@ -144,7 +151,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -144,7 +151,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
//echo "Identification Variable: " .$this->_identificationVariable . "\n";
//echo "Identification Variable: " .$this->_identificationVariable . "\n";
$tableAlias
=
$parserResult
->
generateTableAlias
(
$classMetadata
->
getClassName
());
$tableAlias
=
$parserResult
->
generateTableAlias
(
$classMetadata
->
getClassName
());
$parserResult
->
setQueryComponent
(
$this
->
_identificationVariable
,
$queryComponent
);
$parserResult
->
setQueryComponent
(
$this
->
_identificationVariable
,
$
this
->
_
queryComponent
);
$parserResult
->
setTableAlias
(
$tableAlias
,
$this
->
_identificationVariable
);
$parserResult
->
setTableAlias
(
$tableAlias
,
$this
->
_identificationVariable
);
}
}
...
@@ -158,8 +165,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -158,8 +165,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
// Retrieve the base component
// Retrieve the base component
try
{
try
{
$queryComponent
=
$parserResult
->
getQueryComponent
(
$this
->
_identifiers
[
0
]);
$
this
->
_
queryComponent
=
$parserResult
->
getQueryComponent
(
$this
->
_identifiers
[
0
]);
$classMetadata
=
$queryComponent
[
'metadata'
];
$classMetadata
=
$
this
->
_
queryComponent
[
'metadata'
];
$className
=
$classMetadata
->
getClassName
();
$className
=
$classMetadata
->
getClassName
();
$parent
=
$path
=
$this
->
_identifiers
[
0
];
$parent
=
$path
=
$this
->
_identifiers
[
0
];
}
catch
(
Doctrine_Exception
$e
)
{
}
catch
(
Doctrine_Exception
$e
)
{
...
@@ -175,8 +182,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -175,8 +182,8 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
if
(
$parserResult
->
hasQueryComponent
(
$path
))
{
if
(
$parserResult
->
hasQueryComponent
(
$path
))
{
// We already have the query component on hands, get it
// We already have the query component on hands, get it
$queryComponent
=
$parserResult
->
getQueryComponent
(
$path
);
$
this
->
_
queryComponent
=
$parserResult
->
getQueryComponent
(
$path
);
$classMetadata
=
$queryComponent
[
'metadata'
];
$classMetadata
=
$
this
->
_
queryComponent
[
'metadata'
];
// If we are in our last check and identification variable is null, we throw semantical error
// If we are in our last check and identification variable is null, we throw semantical error
if
(
$i
==
$l
-
1
&&
$this
->
_identificationVariable
===
null
)
{
if
(
$i
==
$l
-
1
&&
$this
->
_identificationVariable
===
null
)
{
...
@@ -204,7 +211,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -204,7 +211,7 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
$relation
=
$classMetadata
->
getAssociationMapping
(
$relationName
);
$relation
=
$classMetadata
->
getAssociationMapping
(
$relationName
);
$targetClassMetadata
=
$this
->
_em
->
getClassMetadata
(
$relation
->
getTargetEntityName
());
$targetClassMetadata
=
$this
->
_em
->
getClassMetadata
(
$relation
->
getTargetEntityName
());
$queryComponent
=
array
(
$
this
->
_
queryComponent
=
array
(
'metadata'
=>
$targetClassMetadata
,
'metadata'
=>
$targetClassMetadata
,
'parent'
=>
$parent
,
'parent'
=>
$parent
,
'relation'
=>
$relation
,
'relation'
=>
$relation
,
...
@@ -228,29 +235,24 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
...
@@ -228,29 +235,24 @@ class Doctrine_Query_Production_RangeVariableDeclaration extends Doctrine_Query_
$tableAlias
=
$parserResult
->
generateTableAlias
(
$targetClassMetadata
->
getClassName
());
$tableAlias
=
$parserResult
->
generateTableAlias
(
$targetClassMetadata
->
getClassName
());
//echo "Table alias: " . $tableAlias . "\n";
$parserResult
->
setQueryComponent
(
$this
->
_identificationVariable
,
$this
->
_queryComponent
);
$parserResult
->
setQueryComponent
(
$this
->
_identificationVariable
,
$queryComponent
);
$parserResult
->
setTableAlias
(
$tableAlias
,
$this
->
_identificationVariable
);
$parserResult
->
setTableAlias
(
$tableAlias
,
$this
->
_identificationVariable
);
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$visitor
->
visitRangeVariableDeclaration
(
$this
);
}
/* Getters */
/* Getters */
public
function
getIdentifiers
()
public
function
getIdentifiers
()
{
{
return
$this
->
_identifiers
;
return
$this
->
_identifiers
;
}
}
public
function
getQueryComponent
()
{
return
$this
->
_queryComponent
;
}
public
function
getIdentificationVariable
()
public
function
getIdentificationVariable
()
{
{
return
$this
->
_identificationVariable
;
return
$this
->
_identificationVariable
;
...
...
lib/Doctrine/Query/Production/SelectClause.php
View file @
efca7941
...
@@ -85,27 +85,15 @@ class Doctrine_Query_Production_SelectClause extends Doctrine_Query_Production
...
@@ -85,27 +85,15 @@ class Doctrine_Query_Production_SelectClause extends Doctrine_Query_Production
{
{
return
$value
->
buildSql
();
return
$value
->
buildSql
();
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
foreach
(
$this
->
_selectExpressions
as
$expression
)
{
$expression
->
accept
(
$visitor
);
}
$visitor
->
visitSelectClause
(
$this
);
}
/* Getters */
/* Getters */
public
function
isDistinct
()
public
function
isDistinct
()
{
{
return
$this
->
_isDistinct
;
return
$this
->
_isDistinct
;
}
}
public
function
getSelectExpressions
()
public
function
getSelectExpressions
()
{
{
return
$this
->
_selectExpressions
;
return
$this
->
_selectExpressions
;
...
...
lib/Doctrine/Query/Production/SelectExpression.php
View file @
efca7941
...
@@ -190,4 +190,23 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
...
@@ -190,4 +190,23 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
{
{
return
!
is_string
(
$value
);
return
!
is_string
(
$value
);
}
}
/* Getters */
public
function
getLeftExpression
()
{
return
$this
->
_leftExpression
;
}
public
function
isSubselect
()
{
return
$this
->
_isSubselect
;
}
public
function
getFieldIdentificationVariable
()
{
return
$this
->
_fieldIdentificationVariable
;
}
}
}
lib/Doctrine/Query/Production/SelectStatement.php
View file @
efca7941
...
@@ -93,58 +93,39 @@ class Doctrine_Query_Production_SelectStatement extends Doctrine_Query_Productio
...
@@ -93,58 +93,39 @@ class Doctrine_Query_Production_SelectStatement extends Doctrine_Query_Productio
.
((
$this
->
_havingClause
!==
null
)
?
' '
.
$this
->
_havingClause
->
buildSql
()
:
''
)
.
((
$this
->
_havingClause
!==
null
)
?
' '
.
$this
->
_havingClause
->
buildSql
()
:
''
)
.
((
$this
->
_orderByClause
!==
null
)
?
' '
.
$this
->
_orderByClause
->
buildSql
()
:
''
);
.
((
$this
->
_orderByClause
!==
null
)
?
' '
.
$this
->
_orderByClause
->
buildSql
()
:
''
);
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_selectClause
->
accept
(
$visitor
);
$this
->
_fromClause
->
accept
(
$visitor
);
if
(
$this
->
_whereClause
)
{
$this
->
_whereClause
->
accept
(
$visitor
);
}
if
(
$this
->
_groupByClause
)
{
$this
->
_groupByClause
->
accept
(
$visitor
);
}
if
(
$this
->
_havingClause
)
{
$this
->
_havingClause
->
accept
(
$visitor
);
}
if
(
$this
->
_orderByClause
)
{
$this
->
_orderByClause
->
accept
(
$visitor
);
}
$visitor
->
visitSelectStatement
(
$this
);
}
/* Getters */
/* Getters */
public
function
getSelectClause
()
public
function
getSelectClause
()
{
{
return
$this
->
_selectClause
;
return
$this
->
_selectClause
;
}
}
public
function
getFromClause
()
public
function
getFromClause
()
{
{
return
$this
->
_fromClause
;
return
$this
->
_fromClause
;
}
}
public
function
getWhereClause
()
public
function
getWhereClause
()
{
{
return
$this
->
_whereClause
;
return
$this
->
_whereClause
;
}
}
public
function
getGroupByClause
()
public
function
getGroupByClause
()
{
{
return
$this
->
_groupByClause
;
return
$this
->
_groupByClause
;
}
}
public
function
getHavingClause
()
public
function
getHavingClause
()
{
{
return
$this
->
_havingClause
;
return
$this
->
_havingClause
;
}
}
public
function
getOrderByClause
()
public
function
getOrderByClause
()
{
{
return
$this
->
_orderByClause
;
return
$this
->
_orderByClause
;
...
...
lib/Doctrine/Query/Production/SimpleConditionalExpression.php
View file @
efca7941
...
@@ -106,26 +106,15 @@ class Doctrine_Query_Production_SimpleConditionalExpression extends Doctrine_Que
...
@@ -106,26 +106,15 @@ class Doctrine_Query_Production_SimpleConditionalExpression extends Doctrine_Que
return
$token
[
'type'
];
return
$token
[
'type'
];
}
}
/**
* Visitor support
*
* @param object $visitor
*/
public
function
accept
(
$visitor
)
{
$this
->
_leftExpression
->
accept
(
$visitor
);
$this
->
_rightExpression
->
accept
(
$visitor
);
$visitor
->
visitSimpleConditionalExpression
(
$this
);
}
/* Getters */
/* Getters */
public
function
getLeftExpression
()
public
function
getLeftExpression
()
{
{
return
$this
->
_leftExpression
;
return
$this
->
_leftExpression
;
}
}
public
function
getRightExpression
()
public
function
getRightExpression
()
{
{
return
$this
->
_rightExpression
;
return
$this
->
_rightExpression
;
...
...
lib/Doctrine/Query/Production/WhereClause.php
View file @
efca7941
...
@@ -49,18 +49,9 @@ class Doctrine_Query_Production_WhereClause extends Doctrine_Query_Production
...
@@ -49,18 +49,9 @@ class Doctrine_Query_Production_WhereClause extends Doctrine_Query_Production
{
{
return
'WHERE '
.
$this
->
_conditionalExpression
->
buildSql
();
return
'WHERE '
.
$this
->
_conditionalExpression
->
buildSql
();
}
}
/**
* Visitor support.
*/
public
function
accept
(
$visitor
)
{
$this
->
_conditionalExpression
->
accept
(
$visitor
);
$visitor
->
visitWhereClause
(
$this
);
}
/* Getters */
/* Getters */
public
function
getConditionalExpression
()
public
function
getConditionalExpression
()
{
{
return
$this
->
_conditionalExpression
;
return
$this
->
_conditionalExpression
;
...
...
lib/Doctrine/Query/SqlBuilder.php
View file @
efca7941
...
@@ -80,7 +80,7 @@ abstract class Doctrine_Query_SqlBuilder
...
@@ -80,7 +80,7 @@ abstract class Doctrine_Query_SqlBuilder
// Here we follow the SQL-99 specifications available at:
// Here we follow the SQL-99 specifications available at:
// http://savage.net.au/SQL/sql-99.bnf
// http://savage.net.au/SQL/sql-99.bnf
// End of Common SQL generations
// End of Common SQL generations
...
...
query-language.txt
View file @
efca7941
...
@@ -37,7 +37,8 @@ OrderByItem = Expression ["ASC" | "DESC"]
...
@@ -37,7 +37,8 @@ OrderByItem = Expression ["ASC" | "DESC"]
GroupByItem = PathExpression
GroupByItem = PathExpression
UpdateItem = PathExpression "=" (Expression | "NULL")
UpdateItem = PathExpression "=" (Expression | "NULL")
IdentificationVariableDeclaration = RangeVariableDeclaration [IndexBy] {Join [IndexBy]}
IdentificationVariableDeclaration = RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}
JoinVariableDeclaration = Join [IndexBy]
RangeVariableDeclaration = identifier {"." identifier} [["AS"] IdentificationVariable]
RangeVariableDeclaration = identifier {"." identifier} [["AS"] IdentificationVariable]
VariableDeclaration = identifier [["AS"] IdentificationVariable]
VariableDeclaration = identifier [["AS"] IdentificationVariable]
IdentificationVariable = identifier
IdentificationVariable = identifier
...
...
tests/Orm/Query/SelectSqlGenerationTest.php
View file @
efca7941
...
@@ -167,4 +167,13 @@ class Orm_Query_SelectSqlGenerationTest extends Doctrine_OrmTestCase
...
@@ -167,4 +167,13 @@ class Orm_Query_SelectSqlGenerationTest extends Doctrine_OrmTestCase
);
);
}
}
public
function
testPlainJoinWithoutClause
()
{
$this
->
assertSqlGeneration
(
'SELECT u.id, a.id FROM CmsUser u LEFT JOIN u.articles a'
,
'SELECT cu.id AS cu__id, ca.id AS ca__id FROM cms_user cu LEFT JOIN cms_article ca ON ca.user_id = cu.id WHERE 1 = 1'
);
}
}
}
\ No newline at end of file
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