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
a56689be
Commit
a56689be
authored
Mar 01, 2010
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Reverted wrong changeset of commit related to 7246
parent
fc5960c4
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
127 deletions
+61
-127
Configuration.php
lib/Doctrine/ORM/Configuration.php
+11
-11
ClassMetadataFactory.php
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
+4
-19
MappingException.php
lib/Doctrine/ORM/Mapping/MappingException.php
+0
-7
Lexer.php
lib/Doctrine/ORM/Query/Lexer.php
+38
-39
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+4
-14
AnnotationExporter.php
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
+0
-21
annotation.tpl.php
lib/Doctrine/ORM/Tools/Export/Driver/annotation.tpl.php
+0
-1
EntityRepositoryTest.php
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
+0
-11
QueryTest.php
tests/Doctrine/Tests/ORM/Functional/QueryTest.php
+4
-4
No files found.
lib/Doctrine/ORM/Configuration.php
View file @
a56689be
...
...
@@ -52,7 +52,7 @@ class Configuration extends \Doctrine\DBAL\Configuration
'namedNativeQueries'
=>
array
(),
'autoGenerateProxyClasses'
=>
true
,
'proxyNamespace'
=>
null
,
'entity
Namespaces
'
=>
array
()
'entity
AliasMap
'
=>
array
()
));
}
...
...
@@ -121,24 +121,24 @@ class Configuration extends \Doctrine\DBAL\Configuration
}
/**
* Add a
namespace alias for entities
.
* Add a
n alias for an entity
.
*
* @param string $className
* @param string $alias
* @param string $namespace
*/
public
function
addEntity
Namespace
(
$alias
,
$namespace
)
public
function
addEntity
Alias
(
$className
,
$alias
)
{
$this
->
_attributes
[
'entity
Namespaces'
][
$alias
]
=
$namespac
e
;
$this
->
_attributes
[
'entity
AliasMap'
][
$alias
]
=
$classNam
e
;
}
/**
* get the array of entity
namespac
es
* get the array of entity
alias
es
*
* @return array $
entityNamespaces
* @return array $
aliasMap
*/
public
function
getEntity
Namespaces
()
public
function
getEntity
AliasMap
()
{
return
$this
->
_attributes
[
'entity
Namespaces
'
];
return
$this
->
_attributes
[
'entity
AliasMap
'
];
}
/**
...
...
@@ -147,9 +147,9 @@ class Configuration extends \Doctrine\DBAL\Configuration
* @param array $entityAliasMap
* @return void
*/
public
function
setEntity
Namespaces
(
array
$entityNamespaces
)
public
function
setEntity
AliasMap
(
array
$entityAliasMap
)
{
$this
->
_attributes
[
'entity
Namespaces'
]
=
$entityNamespaces
;
$this
->
_attributes
[
'entity
AliasMap'
]
=
$entityAliasMap
;
}
/**
...
...
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
View file @
a56689be
...
...
@@ -127,11 +127,12 @@ class ClassMetadataFactory
*/
public
function
getMetadataFor
(
$className
)
{
$className
=
$this
->
_resolveClassName
(
$className
);
if
(
!
isset
(
$this
->
_loadedMetadata
[
$className
]))
{
$aliasMap
=
$this
->
_em
->
getConfiguration
()
->
getEntityAliasMap
();
if
(
isset
(
$aliasMap
[
$className
]))
{
$className
=
$aliasMap
[
$className
];
}
$cacheKey
=
"
$className
\$
CLASSMETADATA"
;
if
(
$this
->
_cacheDriver
)
{
if
((
$cached
=
$this
->
_cacheDriver
->
fetch
(
$cacheKey
))
!==
false
)
{
$this
->
_loadedMetadata
[
$className
]
=
$cached
;
...
...
@@ -378,20 +379,4 @@ class ClassMetadataFactory
throw
new
ORMException
(
"Unknown generator type: "
.
$class
->
generatorType
);
}
}
protected
function
_resolveClassName
(
$className
)
{
if
((
$pos
=
strrpos
(
$className
,
':'
))
!==
false
)
{
$entityNamespaces
=
$this
->
_em
->
getConfiguration
()
->
getEntityNamespaces
();
$entityNamespace
=
substr
(
$className
,
0
,
$pos
);
if
(
!
isset
(
$entityNamespaces
[
$entityNamespace
]))
{
throw
MappingException
::
unknownEntityNamespace
(
$entityNamespace
,
$className
);
}
$className
=
trim
(
$entityNamespaces
[
$entityNamespace
],
'\\'
)
.
'\\'
.
substr
(
$className
,
$pos
+
1
);
}
return
$className
;
}
}
lib/Doctrine/ORM/Mapping/MappingException.php
View file @
a56689be
...
...
@@ -185,11 +185,4 @@ class MappingException extends \Doctrine\ORM\ORMException
"does not exist."
);
}
public
static
function
unknownEntityNamespace
(
$namespace
,
$entity
)
{
return
new
self
(
"Unknown Entity namespace '
$namespace
' when processing '
$entity
'."
);
}
}
\ No newline at end of file
lib/Doctrine/ORM/Query/Lexer.php
View file @
a56689be
...
...
@@ -51,44 +51,43 @@ class Lexer extends \Doctrine\Common\Lexer
const
T_BOTH
=
108
;
const
T_BY
=
109
;
const
T_CLOSE_PARENTHESIS
=
110
;
const
T_COLON
=
111
;
const
T_COMMA
=
112
;
const
T_COUNT
=
113
;
const
T_DELETE
=
114
;
const
T_DESC
=
115
;
const
T_DISTINCT
=
116
;
const
T_DIVIDE
=
117
;
const
T_DOT
=
118
;
const
T_EMPTY
=
119
;
const
T_EQUALS
=
120
;
const
T_ESCAPE
=
121
;
const
T_EXISTS
=
122
;
const
T_FALSE
=
123
;
const
T_FROM
=
124
;
const
T_GREATER_THAN
=
125
;
const
T_GROUP
=
126
;
const
T_HAVING
=
127
;
const
T_IN
=
128
;
const
T_INDEX
=
129
;
const
T_INNER
=
130
;
const
T_IS
=
131
;
const
T_JOIN
=
132
;
const
T_LEADING
=
133
;
const
T_LEFT
=
134
;
const
T_LIKE
=
135
;
const
T_LIMIT
=
136
;
const
T_LOWER_THAN
=
137
;
const
T_MAX
=
138
;
const
T_MEMBER
=
139
;
const
T_MIN
=
140
;
const
T_MINUS
=
141
;
const
T_MOD
=
142
;
const
T_MULTIPLY
=
143
;
const
T_NEGATE
=
144
;
const
T_NOT
=
145
;
const
T_NULL
=
146
;
const
T_OF
=
147
;
const
T_OFFSET
=
148
;
const
T_COMMA
=
111
;
const
T_COUNT
=
112
;
const
T_DELETE
=
113
;
const
T_DESC
=
114
;
const
T_DISTINCT
=
115
;
const
T_DIVIDE
=
116
;
const
T_DOT
=
117
;
const
T_EMPTY
=
118
;
const
T_EQUALS
=
119
;
const
T_ESCAPE
=
120
;
const
T_EXISTS
=
121
;
const
T_FALSE
=
122
;
const
T_FROM
=
123
;
const
T_GREATER_THAN
=
124
;
const
T_GROUP
=
125
;
const
T_HAVING
=
126
;
const
T_IN
=
127
;
const
T_INDEX
=
128
;
const
T_INNER
=
129
;
const
T_IS
=
130
;
const
T_JOIN
=
131
;
const
T_LEADING
=
132
;
const
T_LEFT
=
133
;
const
T_LIKE
=
134
;
const
T_LIMIT
=
135
;
const
T_LOWER_THAN
=
136
;
const
T_MAX
=
137
;
const
T_MEMBER
=
138
;
const
T_MIN
=
139
;
const
T_MINUS
=
140
;
const
T_MOD
=
141
;
const
T_MULTIPLY
=
142
;
const
T_NEGATE
=
143
;
const
T_NOT
=
144
;
const
T_NULL
=
145
;
const
T_OF
=
146
;
const
T_OFFSET
=
147
;
const
T_OPEN_PARENTHESIS
=
149
;
const
T_OR
=
150
;
const
T_ORDER
=
151
;
...
...
@@ -124,7 +123,7 @@ class Lexer extends \Doctrine\Common\Lexer
protected
function
getCatchablePatterns
()
{
return
array
(
'[a-z_][a-z0-9_\
:\\\]*[a-z0-9_]{1}
'
,
'[a-z_][a-z0-9_\
\\]*
'
,
'(?:[0-9]+(?:[,\.][0-9]+)*)(?:e[+-]?[0-9]+)?'
,
"'(?:[^']|'')*'"
,
'\?[1-9]+|:[a-z][a-z0-9_]+'
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
a56689be
...
...
@@ -867,20 +867,10 @@ class Parser
$this
->
match
(
Lexer
::
T_IDENTIFIER
);
$schemaName
=
$this
->
_lexer
->
token
[
'value'
];
if
((
$pos
=
strrpos
(
$schemaName
,
':'
))
!==
false
)
{
$entityNamespaces
=
$this
->
_em
->
getConfiguration
()
->
getEntityNamespaces
();
$entityNamespace
=
substr
(
$schemaName
,
0
,
$pos
);
if
(
!
isset
(
$entityNamespaces
[
$entityNamespace
]))
{
$this
->
semanticalError
(
"Unknown Entity namespace '
$entityNamespace
' when processing '
$schemaName
'."
,
$this
->
_lexer
->
token
);
$aliasMap
=
$this
->
_em
->
getConfiguration
()
->
getEntityAliasMap
();
if
(
isset
(
$aliasMap
[
$schemaName
]))
{
$schemaName
=
$aliasMap
[
$schemaName
];
}
$schemaName
=
trim
(
$entityNamespaces
[
$entityNamespace
],
'\\'
)
.
'\\'
.
substr
(
$schemaName
,
$pos
+
1
);
}
$exists
=
class_exists
(
$schemaName
,
true
);
if
(
!
$exists
)
{
...
...
lib/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
View file @
a56689be
...
...
@@ -297,27 +297,6 @@ class AnnotationExporter extends AbstractExporter
return
'@Table('
.
implode
(
', '
,
$table
)
.
')'
;
}
private
function
_getInheritanceAnnotation
(
$metadata
)
{
if
(
$metadata
->
inheritanceType
!=
ClassMetadataInfo
::
INHERITANCE_TYPE_NONE
)
{
switch
(
$metadata
->
inheritanceType
)
{
case
ClassMetadataInfo
::
INHERITANCE_TYPE_JOINED
:
$type
=
"JOINED"
;
break
;
case
ClassMetadataInfo
::
INHERITANCE_TYPE_SINGLE_TABLE
:
$type
=
"SINGLE_TABLE"
;
break
;
case
ClassMetadataInfo
::
INHERITANCE_TYPE_TABLE_PER_CLASS
:
$type
=
"TABLE_PER_CLASS"
;
break
;
}
return
'@InheritanceType("'
.
$type
.
'")'
;
}
return
''
;
}
private
function
_getJoinColumnAnnotation
(
array
$joinColumn
)
{
$joinColumnAnnot
=
array
();
...
...
lib/Doctrine/ORM/Tools/Export/Driver/annotation.tpl.php
View file @
a56689be
...
...
@@ -16,7 +16,6 @@ use <?php echo $this->_getClassToExtendNamespace() ?>;
* @Entity
<?php
endif
;
?>
*
<?php
echo
$this
->
_getTableAnnotation
(
$metadata
)
.
"
\n
"
?>
*
<?php
echo
$this
->
_getInheritanceAnnotation
(
$metadata
)
.
"
\n
"
?>
*/
class
<?
Php
echo
$this
->
_getClassName
(
$metadata
)
?><?php
if
(
$this
->
_extendsClass
())
:
?>
extends
<?php
echo
$this
->
_getClassToExtendName
()
?><?php
endif
;
?>
...
...
tests/Doctrine/Tests/ORM/Functional/EntityRepositoryTest.php
View file @
a56689be
...
...
@@ -65,17 +65,6 @@ class EntityRepositoryTest extends \Doctrine\Tests\OrmFunctionalTestCase
$users
=
$repos
->
findAll
();
$this
->
assertEquals
(
2
,
count
(
$users
));
$this
->
_em
->
clear
();
$this
->
_em
->
getConfiguration
()
->
addEntityNamespace
(
'CMS'
,
'Doctrine\Tests\Models\CMS'
);
$repos
=
$this
->
_em
->
getRepository
(
'CMS:CmsUser'
);
$users
=
$repos
->
findAll
();
$this
->
assertEquals
(
2
,
count
(
$users
));
$this
->
_em
->
getConfiguration
()
->
setEntityNamespaces
(
array
());
}
/**
...
...
tests/Doctrine/Tests/ORM/Functional/QueryTest.php
View file @
a56689be
...
...
@@ -227,18 +227,18 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase
->
getSingleResult
();
}
public
function
testSupportsQueriesWithEntity
Namespac
es
()
public
function
testSupportsQueriesWithEntity
Alias
es
()
{
$this
->
_em
->
getConfiguration
()
->
addEntity
Namespace
(
'CMS'
,
'Doctrine\Tests\Models\CMS
'
);
$this
->
_em
->
getConfiguration
()
->
addEntity
Alias
(
'Doctrine\Tests\Models\CMS\CmsUser'
,
'TestAlias
'
);
try
{
$query
=
$this
->
_em
->
createQuery
(
'UPDATE
CMS:CmsUser
u SET u.name = ?1'
);
$query
=
$this
->
_em
->
createQuery
(
'UPDATE
TestAlias
u SET u.name = ?1'
);
$this
->
assertEquals
(
'UPDATE cms_users SET name = ?'
,
$query
->
getSql
());
$query
->
free
();
}
catch
(
\Exception
$e
)
{
$this
->
fail
(
$e
->
getMessage
());
}
$this
->
_em
->
getConfiguration
()
->
setEntity
Namespaces
(
array
());
$this
->
_em
->
getConfiguration
()
->
setEntity
AliasMap
(
array
());
}
}
\ 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