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
955dc09c
Commit
955dc09c
authored
Apr 14, 2010
by
Guilherme Blanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Optimized support to IdentificationVariable in ArithmeticPrimary
parent
d045c6f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
28 deletions
+15
-28
PathExpression.php
lib/Doctrine/ORM/Query/AST/PathExpression.php
+0
-1
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+15
-16
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+0
-11
No files found.
lib/Doctrine/ORM/Query/AST/PathExpression.php
View file @
955dc09c
...
...
@@ -41,7 +41,6 @@ namespace Doctrine\ORM\Query\AST;
*/
class
PathExpression
extends
Node
{
const
TYPE_IDENTIFICATION_VARIABLE
=
1
;
const
TYPE_COLLECTION_VALUED_ASSOCIATION
=
2
;
const
TYPE_SINGLE_VALUED_ASSOCIATION
=
4
;
const
TYPE_STATE_FIELD
=
8
;
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
955dc09c
...
...
@@ -557,40 +557,44 @@ class Parser
{
foreach
(
$this
->
_deferredPathExpressions
as
$deferredItem
)
{
$pathExpression
=
$deferredItem
[
'expression'
];
$parts
=
$pathExpression
->
parts
;
$numParts
=
count
(
$parts
);
$qComp
=
$this
->
_queryComponents
[
$pathExpression
->
identificationVariable
];
$numParts
=
count
(
$pathExpression
->
parts
);
if
(
$numParts
==
0
)
{
$pathExpression
->
parts
=
array
(
$qComp
[
'metadata'
]
->
identifier
[
0
]);
$numParts
++
;
}
$parts
=
$pathExpression
->
parts
;
$aliasIdentificationVariable
=
$pathExpression
->
identificationVariable
;
$parentField
=
$pathExpression
->
identificationVariable
;
$class
=
$qComp
[
'metadata'
];
$fieldType
=
(
$pathExpression
->
expectedType
==
AST\PathExpression
::
TYPE_IDENTIFICATION_VARIABLE
)
?
AST\PathExpression
::
TYPE_IDENTIFICATION_VARIABLE
:
null
;
$fieldType
=
null
;
$curIndex
=
0
;
foreach
(
$parts
as
$field
)
{
// Check if it is not in a state field
if
(
$fieldType
&
AST\PathExpression
::
TYPE_STATE_FIELD
)
{
$this
->
semanticalError
(
'Cannot navigate through state field named '
.
$field
.
' on '
.
$parentField
,
$deferredItem
[
'token'
]
'Cannot navigate through state field named '
.
$field
.
' on '
.
$parentField
,
$deferredItem
[
'token'
]
);
}
// Check if it is not a collection field
if
(
$fieldType
&
AST\PathExpression
::
TYPE_COLLECTION_VALUED_ASSOCIATION
)
{
$this
->
semanticalError
(
'Cannot navigate through collection field named '
.
$field
.
' on '
.
$parentField
,
$deferredItem
[
'token'
]
'Cannot navigate through collection field named '
.
$field
.
' on '
.
$parentField
,
$deferredItem
[
'token'
]
);
}
// Check if field or association exists
if
(
!
isset
(
$class
->
associationMappings
[
$field
])
&&
!
isset
(
$class
->
fieldMappings
[
$field
]))
{
$this
->
semanticalError
(
'Class '
.
$class
->
name
.
' has no field or association named '
.
$field
,
$deferredItem
[
'token'
]
'Class '
.
$class
->
name
.
' has no field or association named '
.
$field
,
$deferredItem
[
'token'
]
);
}
...
...
@@ -650,11 +654,6 @@ class Parser
// We need to recognize which was expected type(s)
$expectedStringTypes
=
array
();
// Validate state field type
if
(
$expectedType
&
AST\PathExpression
::
TYPE_IDENTIFICATION_VARIABLE
)
{
$expectedStringTypes
[]
=
'IdentificationVariable'
;
}
// Validate state field type
if
(
$expectedType
&
AST\PathExpression
::
TYPE_STATE_FIELD
)
{
$expectedStringTypes
[]
=
'StateFieldPathExpression'
;
...
...
@@ -2174,7 +2173,7 @@ class Parser
return
$this
->
SingleValuedPathExpression
();
}
return
$this
->
PathExpression
(
AST\PathExpression
::
TYPE_IDENTIFICATION_VARIABLE
);
return
$this
->
SimpleStateFieldPathExpression
(
);
case
Lexer
::
T_INPUT_PARAMETER
:
return
$this
->
InputParameter
();
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
955dc09c
...
...
@@ -446,17 +446,6 @@ class SqlWalker implements TreeWalker
$sql
=
''
;
switch
(
$pathExpr
->
type
)
{
case
AST\PathExpression
::
TYPE_IDENTIFICATION_VARIABLE
:
$dqlAlias
=
$pathExpr
->
identificationVariable
;
$class
=
$this
->
_queryComponents
[
$dqlAlias
][
'metadata'
];
if
(
$this
->
_useSqlTableAliases
)
{
$sql
.=
$this
->
walkIdentificationVariable
(
$dqlAlias
)
.
'.'
;
}
$sql
.=
$class
->
getQuotedColumnName
(
$class
->
identifier
[
0
],
$this
->
_platform
);
break
;
case
AST\PathExpression
::
TYPE_STATE_FIELD
:
$parts
=
$pathExpr
->
parts
;
$fieldName
=
array_pop
(
$parts
);
...
...
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