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
f83f5c3c
Commit
f83f5c3c
authored
Jan 14, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Code reorganization, preparing for battle.
Fixes Strict error on EntityPersisterMock.
parent
60fb69dd
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
192 additions
and
88 deletions
+192
-88
SelectExpression.php
lib/Doctrine/ORM/Query/AST/SelectExpression.php
+60
-0
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+5
-3
AbstractSchemaName.php
lib/Doctrine/ORM/Query/Parser/AbstractSchemaName.php
+3
-3
AliasIdentificationVariable.php
...Doctrine/ORM/Query/Parser/AliasIdentificationVariable.php
+2
-2
DeleteStatement.php
lib/Doctrine/ORM/Query/Parser/DeleteStatement.php
+3
-3
FieldIdentificationVariable.php
...Doctrine/ORM/Query/Parser/FieldIdentificationVariable.php
+2
-2
FromClause.php
lib/Doctrine/ORM/Query/Parser/FromClause.php
+3
-3
IdentificationVariable.php
lib/Doctrine/ORM/Query/Parser/IdentificationVariable.php
+2
-2
IdentificationVariableDeclaration.php
...ne/ORM/Query/Parser/IdentificationVariableDeclaration.php
+5
-5
IndexBy.php
lib/Doctrine/ORM/Query/Parser/IndexBy.php
+3
-3
Join.php
lib/Doctrine/ORM/Query/Parser/Join.php
+4
-4
JoinVariableDeclaration.php
lib/Doctrine/ORM/Query/Parser/JoinVariableDeclaration.php
+4
-4
QueryLanguage.php
lib/Doctrine/ORM/Query/Parser/QueryLanguage.php
+4
-4
RangeVariableDeclaration.php
lib/Doctrine/ORM/Query/Parser/RangeVariableDeclaration.php
+4
-4
SelectClause.php
lib/Doctrine/ORM/Query/Parser/SelectClause.php
+5
-5
SelectExpression.php
lib/Doctrine/ORM/Query/Parser/SelectExpression.php
+39
-10
SelectStatement.php
lib/Doctrine/ORM/Query/Parser/SelectStatement.php
+11
-11
SimpleStateField.php
lib/Doctrine/ORM/Query/Parser/SimpleStateField.php
+2
-2
SimpleStateFieldPathExpression.php
...trine/ORM/Query/Parser/SimpleStateFieldPathExpression.php
+4
-4
UpdateStatement.php
lib/Doctrine/ORM/Query/Parser/UpdateStatement.php
+3
-3
ParserDataHolder.php
lib/Doctrine/ORM/Query/ParserDataHolder.php
+1
-1
ParserRule.php
lib/Doctrine/ORM/Query/ParserRule.php
+21
-8
Doctrine_EntityPersisterMock.php
tests/lib/mocks/Doctrine_EntityPersisterMock.php
+2
-2
No files found.
lib/Doctrine/ORM/Query/AST/SelectExpression.php
0 → 100644
View file @
f83f5c3c
<?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>.
*/
/**
* SelectClause = "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}
*
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link http://www.phpdoctrine.org
* @since 2.0
* @version $Revision$
*/
class
Doctrine_ORM_Query_AST_SelectExpression
extends
Doctrine_ORM_Query_AST
{
protected
$_expression
;
protected
$_fieldIdentificationVariable
;
/* Setters */
public
function
setExpression
(
$expression
)
{
$this
->
_expression
=
$expression
;
}
public
function
setFieldIdentificationVariable
(
$fieldIdentificationVariable
)
{
$this
->
_fieldIdentificationVariable
=
$fieldIdentificationVariable
;
}
/* Getters */
public
function
getExpression
()
{
return
$this
->
_expression
;
}
public
function
getFieldIdentificationVariable
()
{
return
$this
->
_fieldIdentificationVariable
;
}
}
\ No newline at end of file
lib/Doctrine/ORM/Query/Parser.php
View file @
f83f5c3c
...
@@ -130,11 +130,13 @@ class Doctrine_ORM_Query_Parser
...
@@ -130,11 +130,13 @@ class Doctrine_ORM_Query_Parser
$this
->
_scanner
=
new
Doctrine_ORM_Query_Scanner
(
$this
->
_input
);
$this
->
_scanner
=
new
Doctrine_ORM_Query_Scanner
(
$this
->
_input
);
$this
->
_sqlBuilder
=
new
Doctrine_ORM_Query_SqlBuilder
(
$this
->
_em
);
$this
->
_sqlBuilder
=
new
Doctrine_ORM_Query_SqlBuilder
(
$this
->
_em
);
$this
->
_keywordTable
=
new
Doctrine_ORM_Query_Token
();
$this
->
_keywordTable
=
new
Doctrine_ORM_Query_Token
();
$defaultQueryComponent
=
Doctrine_ORM_Query_ParserRule
::
DEFAULT_QUERYCOMPONENT
;
$this
->
_parserResult
=
new
Doctrine_ORM_Query_ParserResult
(
$this
->
_parserResult
=
new
Doctrine_ORM_Query_ParserResult
(
''
,
''
,
array
(
// queryComponent
array
(
// queryComponent
'dctrn'
=>
array
(
$defaultQueryComponent
=>
array
(
'metadata'
=>
null
,
'metadata'
=>
null
,
'parent'
=>
null
,
'parent'
=>
null
,
'relation'
=>
null
,
'relation'
=>
null
,
...
@@ -143,7 +145,7 @@ class Doctrine_ORM_Query_Parser
...
@@ -143,7 +145,7 @@ class Doctrine_ORM_Query_Parser
),
),
),
),
array
(
// tableAliasMap
array
(
// tableAliasMap
'dctrn'
=>
'dctrn'
,
$defaultQueryComponent
=>
$defaultQueryComponent
,
)
)
);
);
...
@@ -234,7 +236,7 @@ class Doctrine_ORM_Query_Parser
...
@@ -234,7 +236,7 @@ class Doctrine_ORM_Query_Parser
// Building the Abstract Syntax Tree
// Building the Abstract Syntax Tree
// We have to double the call of QueryLanguage to allow it to work correctly... =\
// We have to double the call of QueryLanguage to allow it to work correctly... =\
$DQL
=
new
Doctrine_ORM_Query_Parser_QueryLanguage
(
$this
);
$DQL
=
new
Doctrine_ORM_Query_Parser_QueryLanguage
(
$this
);
$AST
=
$DQL
->
parse
(
'QueryLanguage'
,
Doctrine_ORM_Query_ParserParamHolder
::
create
()
);
$AST
=
$DQL
->
parse
(
'QueryLanguage'
);
// Check for end of string
// Check for end of string
if
(
$this
->
lookahead
!==
null
)
{
if
(
$this
->
lookahead
!==
null
)
{
...
...
lib/Doctrine/ORM/Query/Parser/AbstractSchemaName.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// AbstractSchemaName ::= identifier
// AbstractSchemaName ::= identifier
$this
->
_AST
=
$this
->
AST
(
'AbstractSchemaName'
);
$this
->
_AST
=
$this
->
AST
(
'AbstractSchemaName'
);
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$componentName
=
$this
->
_AST
->
getComponentName
();
$componentName
=
$this
->
_AST
->
getComponentName
();
...
@@ -62,6 +62,6 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
...
@@ -62,6 +62,6 @@ class Doctrine_ORM_Query_Parser_AbstractSchemaName extends Doctrine_ORM_Query_Pa
protected
function
_isDoctrineEntity
(
$componentName
)
protected
function
_isDoctrineEntity
(
$componentName
)
{
{
return
class_exists
(
$componentName
)
/* &&
is_subclass_of
($componentName, 'Doctrine_ORM_Entity')*/
;
return
class_exists
(
$componentName
)
/* &&
class_implements
($componentName, 'Doctrine_ORM_Entity')*/
;
}
}
}
}
lib/Doctrine/ORM/Query/Parser/AliasIdentificationVariable.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_AliasIdentificationVariable extends Doctrine_ORM
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_AliasIdentificationVariable extends Doctrine_ORM
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// AliasIdentificationVariable = identifier
// AliasIdentificationVariable = identifier
$this
->
_AST
=
$this
->
AST
(
'AliasIdentificationVariable'
);
$this
->
_AST
=
$this
->
AST
(
'AliasIdentificationVariable'
);
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_AliasIdentificationVariable extends Doctrine_ORM
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_AliasIdentificationVariable extends Doctrine_ORM
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
...
...
lib/Doctrine/ORM/Query/Parser/DeleteStatement.php
View file @
f83f5c3c
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_DeleteStatement extends Doctrine_ORM_Query_Parse
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_DeleteStatement extends Doctrine_ORM_Query_Parse
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// DeleteStatement ::= DeleteClause [WhereClause]
// DeleteStatement ::= DeleteClause [WhereClause]
$this
->
_AST
=
$this
->
AST
(
'DeleteStatement'
);
$this
->
_AST
=
$this
->
AST
(
'DeleteStatement'
);
$this
->
_AST
->
setDeleteClause
(
$this
->
parse
(
'DeleteClause'
,
$paramHolder
));
$this
->
_AST
->
setDeleteClause
(
$this
->
parse
(
'DeleteClause'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
,
$paramHolder
));
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
));
}
}
// Return AST node
// Return AST node
...
...
lib/Doctrine/ORM/Query/Parser/FieldIdentificationVariable.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_FieldIdentificationVariable extends Doctrine_ORM
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_FieldIdentificationVariable extends Doctrine_ORM
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// FieldIdentificationVariable ::= identifier
// FieldIdentificationVariable ::= identifier
$this
->
_AST
=
$this
->
AST
(
'FieldIdentificationVariable'
);
$this
->
_AST
=
$this
->
AST
(
'FieldIdentificationVariable'
);
...
@@ -47,7 +47,7 @@ class Doctrine_ORM_Query_Parser_FieldIdentificationVariable extends Doctrine_ORM
...
@@ -47,7 +47,7 @@ class Doctrine_ORM_Query_Parser_FieldIdentificationVariable extends Doctrine_ORM
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
...
...
lib/Doctrine/ORM/Query/Parser/FromClause.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_FromClause extends Doctrine_ORM_Query_ParserRule
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_FromClause extends Doctrine_ORM_Query_ParserRule
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}
// FromClause ::= "FROM" IdentificationVariableDeclaration {"," IdentificationVariableDeclaration}
$this
->
_AST
=
$this
->
AST
(
'FromClause'
);
$this
->
_AST
=
$this
->
AST
(
'FromClause'
);
...
@@ -42,14 +42,14 @@ class Doctrine_ORM_Query_Parser_FromClause extends Doctrine_ORM_Query_ParserRule
...
@@ -42,14 +42,14 @@ class Doctrine_ORM_Query_Parser_FromClause extends Doctrine_ORM_Query_ParserRule
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_FROM
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_FROM
);
$this
->
_AST
->
addIdentificationVariableDeclaration
(
$this
->
_AST
->
addIdentificationVariableDeclaration
(
$this
->
parse
(
'IdentificationVariableDeclaration'
,
$paramHolder
)
$this
->
parse
(
'IdentificationVariableDeclaration'
)
);
);
while
(
$this
->
_isNextToken
(
','
))
{
while
(
$this
->
_isNextToken
(
','
))
{
$this
->
_parser
->
match
(
','
);
$this
->
_parser
->
match
(
','
);
$this
->
_AST
->
addIdentificationVariableDeclaration
(
$this
->
_AST
->
addIdentificationVariableDeclaration
(
$this
->
parse
(
'IdentificationVariableDeclaration'
,
$paramHolder
)
$this
->
parse
(
'IdentificationVariableDeclaration'
)
);
);
}
}
...
...
lib/Doctrine/ORM/Query/Parser/IdentificationVariable.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_IdentificationVariable extends Doctrine_ORM_Quer
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_IdentificationVariable extends Doctrine_ORM_Quer
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// IdentificationVariable ::= identifier
// IdentificationVariable ::= identifier
$this
->
_AST
=
$this
->
AST
(
'IdentificationVariable'
);
$this
->
_AST
=
$this
->
AST
(
'IdentificationVariable'
);
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_IdentificationVariable extends Doctrine_ORM_Quer
...
@@ -44,7 +44,7 @@ class Doctrine_ORM_Query_Parser_IdentificationVariable extends Doctrine_ORM_Quer
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
...
...
lib/Doctrine/ORM/Query/Parser/IdentificationVariableDeclaration.php
View file @
f83f5c3c
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_IdentificationVariableDeclaration extends Doctri
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_IdentificationVariableDeclaration extends Doctri
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}*
// IdentificationVariableDeclaration ::= RangeVariableDeclaration [IndexBy] {JoinVariableDeclaration}*
$this
->
_AST
=
$this
->
AST
(
'IdentificationVariableDeclaration'
);
$this
->
_AST
=
$this
->
AST
(
'IdentificationVariableDeclaration'
);
$this
->
_AST
->
setRangeVariableDeclaration
(
$this
->
parse
(
'RangeVariableDeclaration'
,
$paramHolder
));
$this
->
_AST
->
setRangeVariableDeclaration
(
$this
->
parse
(
'RangeVariableDeclaration'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INDEX
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INDEX
))
{
$this
->
_AST
->
setIndexBy
(
$this
->
parse
(
'IndexBy'
,
$paramHolder
));
$this
->
_AST
->
setIndexBy
(
$this
->
parse
(
'IndexBy'
));
}
}
while
(
while
(
...
@@ -50,12 +50,12 @@ class Doctrine_ORM_Query_Parser_IdentificationVariableDeclaration extends Doctri
...
@@ -50,12 +50,12 @@ class Doctrine_ORM_Query_Parser_IdentificationVariableDeclaration extends Doctri
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INNER
)
||
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INNER
)
||
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_JOIN
)
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_JOIN
)
)
{
)
{
$this
->
_AST
->
addJoinVariableDeclaration
(
$this
->
parse
(
'JoinVariableDeclaration'
,
$paramHolder
));
$this
->
_AST
->
addJoinVariableDeclaration
(
$this
->
parse
(
'JoinVariableDeclaration'
));
}
}
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
// If we have an INDEX BY RangeVariableDeclaration
// If we have an INDEX BY RangeVariableDeclaration
if
(
$this
->
_AST
->
getIndexby
()
!==
null
)
{
if
(
$this
->
_AST
->
getIndexby
()
!==
null
)
{
...
...
lib/Doctrine/ORM/Query/Parser/IndexBy.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_IndexBy extends Doctrine_ORM_Query_ParserRule
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_IndexBy extends Doctrine_ORM_Query_ParserRule
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression
// IndexBy ::= "INDEX" "BY" SimpleStateFieldPathExpression
$this
->
_AST
=
$this
->
AST
(
'IndexBy'
);
$this
->
_AST
=
$this
->
AST
(
'IndexBy'
);
...
@@ -42,11 +42,11 @@ class Doctrine_ORM_Query_Parser_IndexBy extends Doctrine_ORM_Query_ParserRule
...
@@ -42,11 +42,11 @@ class Doctrine_ORM_Query_Parser_IndexBy extends Doctrine_ORM_Query_ParserRule
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_INDEX
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_INDEX
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_BY
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_BY
);
$this
->
_AST
->
setSimpleStateFieldPathExpression
(
$this
->
parse
(
'SimpleStateFieldPathExpression'
,
$paramHolder
));
$this
->
_AST
->
setSimpleStateFieldPathExpression
(
$this
->
parse
(
'SimpleStateFieldPathExpression'
));
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
// Retrieving required information
// Retrieving required information
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
...
...
lib/Doctrine/ORM/Query/Parser/Join.php
View file @
f83f5c3c
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
...
@@ -34,7 +34,7 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression
// Join ::= ["LEFT" ["OUTER"] | "INNER"] "JOIN" JoinAssociationPathExpression
// ["AS"] AliasIdentificationVariable [("ON" | "WITH") ConditionalExpression]
// ["AS"] AliasIdentificationVariable [("ON" | "WITH") ConditionalExpression]
...
@@ -59,13 +59,13 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
...
@@ -59,13 +59,13 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_JOIN
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_JOIN
);
$this
->
_AST
->
setJoinAssociationPathExpression
(
$this
->
parse
(
'JoinAssociationPathExpression'
,
$paramHolder
));
$this
->
_AST
->
setJoinAssociationPathExpression
(
$this
->
parse
(
'JoinAssociationPathExpression'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_AS
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_AS
))
{
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_AS
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_AS
);
}
}
$this
->
_AST
->
setAliasIdentificationVariable
(
$this
->
parse
(
'AliasIdentificationVariable'
,
$paramHolder
));
$this
->
_AST
->
setAliasIdentificationVariable
(
$this
->
parse
(
'AliasIdentificationVariable'
));
// Check Join where type
// Check Join where type
if
(
if
(
...
@@ -82,7 +82,7 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
...
@@ -82,7 +82,7 @@ class Doctrine_ORM_Query_Parser_Join extends Doctrine_ORM_Query_ParserRule
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_WITH
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_WITH
);
}
}
$this
->
_AST
->
setConditionalExpression
(
$this
->
parse
(
'ConditionalExpression'
,
$paramHolder
));
$this
->
_AST
->
setConditionalExpression
(
$this
->
parse
(
'ConditionalExpression'
));
}
}
// Return AST node
// Return AST node
...
...
lib/Doctrine/ORM/Query/Parser/JoinVariableDeclaration.php
View file @
f83f5c3c
...
@@ -34,20 +34,20 @@ class Doctrine_ORM_Query_Parser_JoinVariableDeclaration extends Doctrine_ORM_Que
...
@@ -34,20 +34,20 @@ class Doctrine_ORM_Query_Parser_JoinVariableDeclaration extends Doctrine_ORM_Que
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// JoinVariableDeclaration ::= Join [IndexBy]
// JoinVariableDeclaration ::= Join [IndexBy]
$this
->
_AST
=
$this
->
AST
(
'JoinVariableDeclaration'
);
$this
->
_AST
=
$this
->
AST
(
'JoinVariableDeclaration'
);
$this
->
_AST
->
setJoin
(
$this
->
parse
(
'Join'
,
$paramHolder
));
$this
->
_AST
->
setJoin
(
$this
->
parse
(
'Join'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INDEX
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_INDEX
))
{
$this
->
_AST
->
setIndexBy
(
$this
->
parse
(
'IndexBy'
,
$paramHolder
));
$this
->
_AST
->
setIndexBy
(
$this
->
parse
(
'IndexBy'
));
}
}
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
// If we have an INDEX BY JoinVariableDeclaration
// If we have an INDEX BY JoinVariableDeclaration
if
(
$this
->
_AST
->
getIndexby
()
!==
null
)
{
if
(
$this
->
_AST
->
getIndexby
()
!==
null
)
{
...
...
lib/Doctrine/ORM/Query/Parser/QueryLanguage.php
View file @
f83f5c3c
...
@@ -33,20 +33,20 @@
...
@@ -33,20 +33,20 @@
*/
*/
class
Doctrine_ORM_Query_Parser_QueryLanguage
extends
Doctrine_ORM_Query_ParserRule
class
Doctrine_ORM_Query_Parser_QueryLanguage
extends
Doctrine_ORM_Query_ParserRule
{
{
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// QueryLanguage ::= SelectStatement | UpdateStatement | DeleteStatement
// QueryLanguage ::= SelectStatement | UpdateStatement | DeleteStatement
switch
(
$this
->
_parser
->
lookahead
[
'type'
])
{
switch
(
$this
->
_parser
->
lookahead
[
'type'
])
{
case
Doctrine_ORM_Query_Token
::
T_SELECT
:
case
Doctrine_ORM_Query_Token
::
T_SELECT
:
return
$this
->
parse
(
'SelectStatement'
,
$paramHolder
);
return
$this
->
parse
(
'SelectStatement'
);
break
;
break
;
case
Doctrine_ORM_Query_Token
::
T_UPDATE
:
case
Doctrine_ORM_Query_Token
::
T_UPDATE
:
return
$this
->
parse
(
'UpdateStatement'
,
$paramHolder
);
return
$this
->
parse
(
'UpdateStatement'
);
break
;
break
;
case
Doctrine_ORM_Query_Token
::
T_DELETE
:
case
Doctrine_ORM_Query_Token
::
T_DELETE
:
return
$this
->
parse
(
'DeleteStatement'
,
$paramHolder
);
return
$this
->
parse
(
'DeleteStatement'
);
break
;
break
;
default
:
default
:
...
...
lib/Doctrine/ORM/Query/Parser/RangeVariableDeclaration.php
View file @
f83f5c3c
...
@@ -34,22 +34,22 @@ class Doctrine_ORM_Query_Parser_RangeVariableDeclaration extends Doctrine_ORM_Qu
...
@@ -34,22 +34,22 @@ class Doctrine_ORM_Query_Parser_RangeVariableDeclaration extends Doctrine_ORM_Qu
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
// RangeVariableDeclaration ::= AbstractSchemaName ["AS"] AliasIdentificationVariable
$this
->
_AST
=
$this
->
AST
(
'RangeVariableDeclaration'
);
$this
->
_AST
=
$this
->
AST
(
'RangeVariableDeclaration'
);
$this
->
_AST
->
setAbstractSchemaName
(
$this
->
parse
(
'AbstractSchemaName'
,
$paramHolder
));
$this
->
_AST
->
setAbstractSchemaName
(
$this
->
parse
(
'AbstractSchemaName'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_AS
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_AS
))
{
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_AS
);
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_AS
);
}
}
$this
->
_AST
->
setAliasIdentificationVariable
(
$this
->
parse
(
'AliasIdentificationVariable'
,
$paramHolder
));
$this
->
_AST
->
setAliasIdentificationVariable
(
$this
->
parse
(
'AliasIdentificationVariable'
));
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
$componentName
=
$this
->
_AST
->
getAbstractSchemaName
()
->
getComponentName
();
$componentName
=
$this
->
_AST
->
getAbstractSchemaName
()
->
getComponentName
();
...
...
lib/Doctrine/ORM/Query/Parser/SelectClause.php
View file @
f83f5c3c
...
@@ -36,7 +36,7 @@ class Doctrine_ORM_Query_Parser_SelectClause extends Doctrine_ORM_Query_ParserRu
...
@@ -36,7 +36,7 @@ class Doctrine_ORM_Query_Parser_SelectClause extends Doctrine_ORM_Query_ParserRu
protected
$_selectExpressions
=
array
();
protected
$_selectExpressions
=
array
();
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// SelectClause ::= "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}
// SelectClause ::= "SELECT" ["DISTINCT"] SelectExpression {"," SelectExpression}
$this
->
_AST
=
$this
->
AST
(
'SelectClause'
);
$this
->
_AST
=
$this
->
AST
(
'SelectClause'
);
...
@@ -51,21 +51,21 @@ class Doctrine_ORM_Query_Parser_SelectClause extends Doctrine_ORM_Query_ParserRu
...
@@ -51,21 +51,21 @@ class Doctrine_ORM_Query_Parser_SelectClause extends Doctrine_ORM_Query_ParserRu
}
}
// Process SelectExpressions (1..N)
// Process SelectExpressions (1..N)
$this
->
_selectExpressions
[]
=
$this
->
parse
(
'SelectExpression'
,
$paramHolder
);
$this
->
_selectExpressions
[]
=
$this
->
parse
(
'SelectExpression'
);
while
(
$this
->
_isNextToken
(
','
))
{
while
(
$this
->
_isNextToken
(
','
))
{
$this
->
_parser
->
match
(
','
);
$this
->
_parser
->
match
(
','
);
$this
->
_selectExpressions
[]
=
$this
->
parse
(
'SelectExpression'
,
$paramHolder
);
$this
->
_selectExpressions
[]
=
$this
->
parse
(
'SelectExpression'
);
}
}
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
// We need to validate each SelectExpression
// We need to validate each SelectExpression
for
(
$i
=
0
,
$l
=
count
(
$this
->
_selectExpressions
);
$i
<
$l
;
$i
++
)
{
for
(
$i
=
0
,
$l
=
count
(
$this
->
_selectExpressions
);
$i
<
$l
;
$i
++
)
{
$this
->
_AST
->
addSelectExpression
(
$this
->
_selectExpressions
[
$i
]
->
semantical
(
$paramHolder
));
$this
->
_AST
->
addSelectExpression
(
$this
->
_selectExpressions
[
$i
]
->
semantical
());
}
}
// Return AST node
// Return AST node
...
...
lib/Doctrine/ORM/Query/Parser/SelectExpression.php
View file @
f83f5c3c
...
@@ -35,31 +35,60 @@ class Doctrine_ORM_Query_Parser_SelectExpression extends Doctrine_ORM_Query_Pars
...
@@ -35,31 +35,60 @@ class Doctrine_ORM_Query_Parser_SelectExpression extends Doctrine_ORM_Query_Pars
{
{
protected
$_AST
=
null
;
protected
$_AST
=
null
;
protected
$_expression
=
null
;
protected
$_fieldIdentificationVariable
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// SelectExpression ::= IdentificationVariable ["." "*"] |
// SelectExpression ::= IdentificationVariable ["." "*"] | StateFieldPathExpression |
// (StateFieldPathExpression | AggregateExpression | "(" Subselect ")" )
// ( ( AggregateExpression | "(" Subselect ")" ) ["AS"] FieldIdentificationVariable )
// [["AS"] FieldIdentificationVariable]
// First we recognize for an IdentificationVariable (Component alias)
// First we recognize for an IdentificationVariable (Component alias)
if
(
$this
->
_isIdentificationVariable
())
{
if
(
$this
->
_isIdentificationVariable
())
{
$
identificationVariable
=
$this
->
parse
(
'IdentificationVariable'
,
$paramHolder
);
$
this
->
_expression
=
$this
->
parse
(
'IdentificationVariable'
);
// Inspecting if we are in a ["." "*"]
// Inspecting if we are in a ["." "*"]
if
(
$this
->
_isNextToken
(
'.'
))
{
if
(
$this
->
_isNextToken
(
'.'
))
{
$this
->
_parser
->
match
(
'.'
);
$this
->
_parser
->
match
(
'.'
);
$this
->
_parser
->
match
(
'*'
);
$this
->
_parser
->
match
(
'*'
);
}
}
}
else
if
(
$this
->
_isFunction
()
||
$this
->
_isSubselect
())
{
$this
->
_expression
=
$this
->
parse
(
$this
->
_isFunction
()
?
'AggregateExpression'
:
'Subselect'
);
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_AS
))
{
$this
->
_parser
->
match
(
Doctrine_ORM_Query_Token
::
T_AS
);
}
$this
->
_fieldIdentificationVariable
=
$this
->
parse
(
'FieldIdentificationVariable'
);
}
else
{
$this
->
_expression
=
$this
->
parse
(
'StateFieldPathExpression'
);
}
}
public
function
semantical
()
{
$expression
=
$this
->
_expression
->
semantical
();
if
(
$this
->
_fieldIdentificationVariable
!==
null
)
{
$expr
=
$expression
;
return
$identificationVariable
;
$expression
=
$this
->
AST
(
'SelectExpression'
);
$expression
->
setExpression
(
$expr
);
$expression
->
setFieldIdentificationVariable
(
$this
->
_fieldIdentificationVariable
->
semantical
());
}
}
return
$expression
;
}
}
protected
function
_isIdentificationVariable
()
protected
function
_isIdentificationVariable
()
{
{
//
Ret
rying to recoginize this grammar: IdentificationVariable ["." "*"]
//
T
rying to recoginize this grammar: IdentificationVariable ["." "*"]
$token
=
$this
->
_parser
->
lookahead
;
$token
=
$this
->
_parser
->
lookahead
;
$this
->
_parser
->
getScanner
()
->
resetPeek
();
$this
->
_parser
->
getScanner
()
->
resetPeek
();
...
@@ -70,7 +99,7 @@ class Doctrine_ORM_Query_Parser_SelectExpression extends Doctrine_ORM_Query_Pars
...
@@ -70,7 +99,7 @@ class Doctrine_ORM_Query_Parser_SelectExpression extends Doctrine_ORM_Query_Pars
// If we have a dot ".", then next char must be the "*"
// If we have a dot ".", then next char must be the "*"
if
(
$token
[
'value'
]
===
'.'
)
{
if
(
$token
[
'value'
]
===
'.'
)
{
$token
=
$this
->
_parser
->
getScanner
()
->
peek
();
$token
=
$this
->
_parser
->
getScanner
()
->
peek
();
return
$token
[
'value'
]
===
'*'
;
return
$token
[
'value'
]
===
'*'
;
}
}
}
}
...
...
lib/Doctrine/ORM/Query/Parser/SelectStatement.php
View file @
f83f5c3c
...
@@ -36,7 +36,7 @@ class Doctrine_ORM_Query_Parser_SelectStatement extends Doctrine_ORM_Query_Parse
...
@@ -36,7 +36,7 @@ class Doctrine_ORM_Query_Parser_SelectStatement extends Doctrine_ORM_Query_Parse
protected
$_selectClause
=
null
;
protected
$_selectClause
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// SelectStatement ::= SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
// SelectStatement ::= SelectClause FromClause [WhereClause] [GroupByClause] [HavingClause] [OrderByClause]
$this
->
_AST
=
$this
->
AST
(
'SelectStatement'
);
$this
->
_AST
=
$this
->
AST
(
'SelectStatement'
);
...
@@ -44,36 +44,36 @@ class Doctrine_ORM_Query_Parser_SelectStatement extends Doctrine_ORM_Query_Parse
...
@@ -44,36 +44,36 @@ class Doctrine_ORM_Query_Parser_SelectStatement extends Doctrine_ORM_Query_Parse
// Disable the semantical check for SelectClause now. This is needed
// Disable the semantical check for SelectClause now. This is needed
// since we dont know the query components yet (will be known only
// since we dont know the query components yet (will be known only
// when the FROM and WHERE clause are processed).
// when the FROM and WHERE clause are processed).
$
param
Holder
->
set
(
'semanticalCheck'
,
false
);
$
this
->
_data
Holder
->
set
(
'semanticalCheck'
,
false
);
$this
->
_selectClause
=
$this
->
parse
(
'SelectClause'
,
$paramHolder
);
$this
->
_selectClause
=
$this
->
parse
(
'SelectClause'
);
$
param
Holder
->
remove
(
'semanticalCheck'
);
$
this
->
_data
Holder
->
remove
(
'semanticalCheck'
);
$this
->
_AST
->
setFromClause
(
$this
->
parse
(
'FromClause'
,
$paramHolder
));
$this
->
_AST
->
setFromClause
(
$this
->
parse
(
'FromClause'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
,
$paramHolder
));
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
));
}
}
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_GROUP
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_GROUP
))
{
$this
->
_AST
->
setGroupByClause
(
$this
->
parse
(
'GroupByClause'
,
$paramHolder
));
$this
->
_AST
->
setGroupByClause
(
$this
->
parse
(
'GroupByClause'
));
}
}
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_HAVING
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_HAVING
))
{
$this
->
_AST
->
setHavingClause
(
$this
->
parse
(
'HavingClause'
,
$paramHolder
));
$this
->
_AST
->
setHavingClause
(
$this
->
parse
(
'HavingClause'
));
}
}
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_ORDER
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_ORDER
))
{
$this
->
_AST
->
setOrderByClause
(
$this
->
parse
(
'OrderByClause'
,
$paramHolder
));
$this
->
_AST
->
setOrderByClause
(
$this
->
parse
(
'OrderByClause'
));
}
}
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
// We need to invoke the semantical check of SelectClause here, since
// We need to invoke the semantical check of SelectClause here, since
// it was not yet checked.
// it was not yet checked.
// The semantical checks will be forwarded to all SelectClause dependant grammar rules
// The semantical checks will be forwarded to all SelectClause dependant grammar rules
$this
->
_AST
->
setSelectClause
(
$this
->
_selectClause
->
semantical
(
$paramHolder
));
$this
->
_AST
->
setSelectClause
(
$this
->
_selectClause
->
semantical
());
// Return AST node
// Return AST node
return
$this
->
_AST
;
return
$this
->
_AST
;
...
...
lib/Doctrine/ORM/Query/Parser/SimpleStateField.php
View file @
f83f5c3c
...
@@ -34,9 +34,9 @@ class Doctrine_ORM_Query_Parser_SimpleStateField extends Doctrine_ORM_Query_Pars
...
@@ -34,9 +34,9 @@ class Doctrine_ORM_Query_Parser_SimpleStateField extends Doctrine_ORM_Query_Pars
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// SimpleStateField ::= FieldIdentificationVariable
// SimpleStateField ::= FieldIdentificationVariable
return
$this
->
parse
(
'FieldIdentificationVariable'
,
$paramHolder
);
return
$this
->
parse
(
'FieldIdentificationVariable'
);
}
}
}
}
\ No newline at end of file
lib/Doctrine/ORM/Query/Parser/SimpleStateFieldPathExpression.php
View file @
f83f5c3c
...
@@ -34,20 +34,20 @@ class Doctrine_ORM_Query_Parser_SimpleStateFieldPathExpression extends Doctrine_
...
@@ -34,20 +34,20 @@ class Doctrine_ORM_Query_Parser_SimpleStateFieldPathExpression extends Doctrine_
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// SimpleStateFieldPathExpression ::= IdentificationVariable "." SimpleStateField
// SimpleStateFieldPathExpression ::= IdentificationVariable "." SimpleStateField
$this
->
_AST
=
$this
->
AST
(
'SimpleStateFieldPathExpression'
);
$this
->
_AST
=
$this
->
AST
(
'SimpleStateFieldPathExpression'
);
$this
->
_AST
->
setIdentificationVariable
(
$this
->
parse
(
'IdentificationVariable'
,
$paramHolder
));
$this
->
_AST
->
setIdentificationVariable
(
$this
->
parse
(
'IdentificationVariable'
));
$this
->
_parser
->
match
(
'.'
);
$this
->
_parser
->
match
(
'.'
);
$this
->
_AST
->
setSimpleStateField
(
$this
->
parse
(
'SimpleStateField'
,
$paramHolder
));
$this
->
_AST
->
setSimpleStateField
(
$this
->
parse
(
'SimpleStateField'
));
}
}
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
$parserResult
=
$this
->
_parser
->
getParserResult
();
$parserResult
=
$this
->
_parser
->
getParserResult
();
$componentAlias
=
$this
->
_AST
->
getIdentificationVariable
()
->
getComponentAlias
();
$componentAlias
=
$this
->
_AST
->
getIdentificationVariable
()
->
getComponentAlias
();
...
...
lib/Doctrine/ORM/Query/Parser/UpdateStatement.php
View file @
f83f5c3c
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_UpdateStatement extends Doctrine_ORM_Query_Parse
...
@@ -34,15 +34,15 @@ class Doctrine_ORM_Query_Parser_UpdateStatement extends Doctrine_ORM_Query_Parse
protected
$_AST
=
null
;
protected
$_AST
=
null
;
public
function
syntax
(
$paramHolder
)
public
function
syntax
()
{
{
// UpdateStatement ::= UpdateClause [WhereClause]
// UpdateStatement ::= UpdateClause [WhereClause]
$this
->
_AST
=
$this
->
AST
(
'UpdateStatement'
);
$this
->
_AST
=
$this
->
AST
(
'UpdateStatement'
);
$this
->
_AST
->
setUpdateClause
(
$this
->
parse
(
'UpdateClause'
,
$paramHolder
));
$this
->
_AST
->
setUpdateClause
(
$this
->
parse
(
'UpdateClause'
));
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
if
(
$this
->
_isNextToken
(
Doctrine_ORM_Query_Token
::
T_WHERE
))
{
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
,
$paramHolder
));
$this
->
_AST
->
setWhereClause
(
$this
->
parse
(
'WhereClause'
));
}
}
// Return AST node
// Return AST node
...
...
lib/Doctrine/ORM/Query/Parser
Param
Holder.php
→
lib/Doctrine/ORM/Query/Parser
Data
Holder.php
View file @
f83f5c3c
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
* @since 2.0
* @since 2.0
* @version $Revision$
* @version $Revision$
*/
*/
class
Doctrine_ORM_Query_Parser
Param
Holder
class
Doctrine_ORM_Query_Parser
Data
Holder
{
{
protected
static
$_instance
;
protected
static
$_instance
;
...
...
lib/Doctrine/ORM/Query/ParserRule.php
View file @
f83f5c3c
...
@@ -57,6 +57,13 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -57,6 +57,13 @@ abstract class Doctrine_ORM_Query_ParserRule
* @var EntityManager
* @var EntityManager
*/
*/
protected
$_em
;
protected
$_em
;
/**
* The Parser Data Holder.
*
* @var ParserDataHolder
*/
protected
$_dataHolder
;
/**
/**
...
@@ -68,6 +75,7 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -68,6 +75,7 @@ abstract class Doctrine_ORM_Query_ParserRule
{
{
$this
->
_parser
=
$parser
;
$this
->
_parser
=
$parser
;
$this
->
_em
=
$this
->
_parser
->
getEntityManager
();
$this
->
_em
=
$this
->
_parser
->
getEntityManager
();
$this
->
_dataHolder
=
Doctrine_ORM_Query_ParserDataHolder
::
create
();
}
}
...
@@ -101,7 +109,7 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -101,7 +109,7 @@ abstract class Doctrine_ORM_Query_ParserRule
* @param array $paramHolder Production parameter holder
* @param array $paramHolder Production parameter holder
* @return Doctrine_ORM_Query_ParserRule
* @return Doctrine_ORM_Query_ParserRule
*/
*/
public
function
parse
(
$RuleName
,
$paramHolder
)
public
function
parse
(
$RuleName
)
{
{
$BNFGrammarRule
=
$this
->
_getGrammarRule
(
$RuleName
);
$BNFGrammarRule
=
$this
->
_getGrammarRule
(
$RuleName
);
...
@@ -109,10 +117,10 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -109,10 +117,10 @@ abstract class Doctrine_ORM_Query_ParserRule
//echo "Params: " . var_export($paramHolder, true) . "\n";
//echo "Params: " . var_export($paramHolder, true) . "\n";
// Syntax check
// Syntax check
if
(
!
$
paramHolder
->
has
(
'syntaxCheck'
)
||
$param
Holder
->
get
(
'syntaxCheck'
)
===
true
)
{
if
(
!
$
this
->
_dataHolder
->
has
(
'syntaxCheck'
)
||
$this
->
_data
Holder
->
get
(
'syntaxCheck'
)
===
true
)
{
//echo "Processing syntax checks of " . $RuleName . "...\n";
//echo "Processing syntax checks of " . $RuleName . "...\n";
$return
=
$BNFGrammarRule
->
syntax
(
$paramHolder
);
$return
=
$BNFGrammarRule
->
syntax
();
if
(
$return
!==
null
)
{
if
(
$return
!==
null
)
{
//echo "Returning Gramma Rule class: " . (is_object($return) ? get_class($return) : $return) . "...\n";
//echo "Returning Gramma Rule class: " . (is_object($return) ? get_class($return) : $return) . "...\n";
...
@@ -122,10 +130,10 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -122,10 +130,10 @@ abstract class Doctrine_ORM_Query_ParserRule
}
}
// Semantical check
// Semantical check
if
(
!
$
paramHolder
->
has
(
'semanticalCheck'
)
||
$param
Holder
->
get
(
'semanticalCheck'
)
===
true
)
{
if
(
!
$
this
->
_dataHolder
->
has
(
'semanticalCheck'
)
||
$this
->
_data
Holder
->
get
(
'semanticalCheck'
)
===
true
)
{
//echo "Processing semantical checks of " . $RuleName . "...\n";
//echo "Processing semantical checks of " . $RuleName . "...\n";
$return
=
$BNFGrammarRule
->
semantical
(
$paramHolder
);
$return
=
$BNFGrammarRule
->
semantical
();
if
(
$return
!==
null
)
{
if
(
$return
!==
null
)
{
//echo "Returning Gramma Rule class: " . (is_object($return) ? get_class($return) : $return) . "...\n";
//echo "Returning Gramma Rule class: " . (is_object($return) ? get_class($return) : $return) . "...\n";
...
@@ -185,18 +193,23 @@ abstract class Doctrine_ORM_Query_ParserRule
...
@@ -185,18 +193,23 @@ abstract class Doctrine_ORM_Query_ParserRule
/**
/**
* @nodoc
* @nodoc
*/
*/
abstract
public
function
syntax
(
$paramHolder
);
abstract
public
function
syntax
();
/**
/**
* @nodoc
* @nodoc
*/
*/
public
function
semantical
(
$paramHolder
)
public
function
semantical
()
{
{
}
}
public
function
getParser
()
public
function
getParser
()
{
{
return
$this
->
_parser
;
return
$this
->
_parser
;
}
}
public
function
getDataHolder
()
{
return
$this
->
_dataHolder
;
}
}
}
tests/lib/mocks/Doctrine_EntityPersisterMock.php
View file @
f83f5c3c
...
@@ -32,12 +32,12 @@ class Doctrine_EntityPersisterMock extends Doctrine_ORM_Persisters_StandardEntit
...
@@ -32,12 +32,12 @@ class Doctrine_EntityPersisterMock extends Doctrine_ORM_Persisters_StandardEntit
$this
->
_mockIdGeneratorType
=
$genType
;
$this
->
_mockIdGeneratorType
=
$genType
;
}
}
public
function
update
(
Doctrine_ORM_Entity
$entity
)
public
function
update
(
$entity
)
{
{
$this
->
_updates
[]
=
$entity
;
$this
->
_updates
[]
=
$entity
;
}
}
public
function
delete
(
Doctrine_ORM_Entity
$entity
)
public
function
delete
(
$entity
)
{
{
$this
->
_deletes
[]
=
$entity
;
$this
->
_deletes
[]
=
$entity
;
}
}
...
...
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