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
968ebb80
Commit
968ebb80
authored
Oct 04, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Bug fixes
parent
fb7adbbe
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
50 deletions
+125
-50
IsolatedClassLoader.php
lib/Doctrine/Common/IsolatedClassLoader.php
+1
-2
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+33
-25
From.php
lib/Doctrine/ORM/Query/Expr/From.php
+10
-0
QueryBuilder.php
lib/Doctrine/ORM/QueryBuilder.php
+80
-20
SchemaTool.php
lib/Doctrine/ORM/Tools/SchemaTool.php
+1
-3
No files found.
lib/Doctrine/Common/IsolatedClassLoader.php
View file @
968ebb80
...
...
@@ -100,7 +100,7 @@ class IsolatedClassLoader
return
false
;
}
if
(
strpos
(
$className
,
$this
->
_namespace
)
!==
0
)
{
if
(
strpos
(
$className
,
$this
->
_namespace
.
$this
->
_namespaceSeparator
)
!==
0
)
{
return
false
;
}
...
...
@@ -113,5 +113,4 @@ class IsolatedClassLoader
return
true
;
}
}
\ No newline at end of file
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
968ebb80
...
...
@@ -55,7 +55,7 @@ class YamlDriver extends AbstractFileDriver
if
(
$element
[
'type'
]
==
'entity'
)
{
$metadata
->
setCustomRepositoryClass
(
isset
(
$element
[
'repositoryClass'
])
?
$
xmlRoo
t
[
'repositoryClass'
]
:
null
isset
(
$element
[
'repositoryClass'
])
?
$
elemen
t
[
'repositoryClass'
]
:
null
);
}
else
if
(
$element
[
'type'
]
==
'mappedSuperclass'
)
{
$metadata
->
isMappedSuperclass
=
true
;
...
...
@@ -113,6 +113,28 @@ class YamlDriver extends AbstractFileDriver
}
}
if
(
isset
(
$element
[
'id'
]))
{
// Evaluate identifier settings
foreach
(
$element
[
'id'
]
as
$name
=>
$idElement
)
{
$mapping
=
array
(
'id'
=>
true
,
'fieldName'
=>
$name
,
'type'
=>
$idElement
[
'type'
]
);
if
(
isset
(
$idElement
[
'column'
]))
{
$mapping
[
'columnName'
]
=
$idElement
[
'column'
];
}
$metadata
->
mapField
(
$mapping
);
if
(
isset
(
$idElement
[
'generator'
]))
{
$metadata
->
setIdGeneratorType
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
.
strtoupper
(
$idElement
[
'generator'
][
'strategy'
])));
}
}
}
// Evaluate fields
if
(
isset
(
$element
[
'fields'
]))
{
foreach
(
$element
[
'fields'
]
as
$name
=>
$fieldMapping
)
{
...
...
@@ -145,33 +167,15 @@ class YamlDriver extends AbstractFileDriver
$mapping
[
'options'
]
=
$fieldMapping
[
'options'
];
}
if
(
isset
(
$fieldMapping
[
'version'
])
&&
$fieldMapping
[
'version'
])
{
$metadata
->
setVersionMapping
(
$mapping
);
}
$metadata
->
mapField
(
$mapping
);
if
(
isset
(
$fieldMapping
[
'notnull'
]))
{
$mapping
[
'notnull'
]
=
$fieldMapping
[
'notnull'
];
}
}
if
(
isset
(
$element
[
'id'
]))
{
// Evaluate identifier settings
foreach
(
$element
[
'id'
]
as
$name
=>
$idElement
)
{
$mapping
=
array
(
'id'
=>
true
,
'fieldName'
=>
$name
,
'type'
=>
$idElement
[
'type'
]
);
if
(
isset
(
$
idElement
[
'column'
])
)
{
$m
apping
[
'columnName'
]
=
$idElement
[
'column'
]
;
if
(
isset
(
$
fieldMapping
[
'version'
])
&&
$fieldMapping
[
'version'
]
)
{
$m
etadata
->
setVersionMapping
(
$mapping
)
;
}
$metadata
->
mapField
(
$mapping
);
if
(
isset
(
$idElement
[
'generator'
]))
{
$metadata
->
setIdGeneratorType
(
constant
(
'Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_'
.
strtoupper
(
$idElement
[
'generator'
][
'strategy'
])));
}
}
}
...
...
@@ -339,6 +343,10 @@ class YamlDriver extends AbstractFileDriver
'referencedColumnName'
=>
$joinColumnElement
[
'referencedColumnName'
]
);
if
(
isset
(
$joinColumnElement
[
'fieldName'
]))
{
$joinColumn
[
'fieldName'
]
=
(
string
)
$joinColumnElement
[
'fieldName'
];
}
if
(
isset
(
$joinColumnElement
[
'unique'
]))
{
$joinColumn
[
'unique'
]
=
(
bool
)
$joinColumnElement
[
'unique'
];
}
...
...
lib/Doctrine/ORM/Query/Expr/From.php
View file @
968ebb80
...
...
@@ -43,6 +43,16 @@ class From
$this
->
_alias
=
$alias
;
}
public
function
getFrom
()
{
return
$this
->
_from
;
}
public
function
getAlias
()
{
return
$this
->
_alias
;
}
public
function
__toString
()
{
return
$this
->
_from
.
(
$this
->
_alias
?
' '
.
$this
->
_alias
:
''
);
...
...
lib/Doctrine/ORM/QueryBuilder.php
View file @
968ebb80
...
...
@@ -55,7 +55,7 @@ class QueryBuilder
*/
private
$_dqlParts
=
array
(
'select'
=>
array
(),
'from'
=>
null
,
'from'
=>
array
()
,
'join'
=>
array
(),
'set'
=>
array
(),
'where'
=>
null
,
...
...
@@ -192,10 +192,6 @@ class QueryBuilder
return
$this
->
_dql
;
}
if
(
!
$this
->
_dqlParts
[
'select'
]
||
!
$this
->
_dqlParts
[
'from'
])
{
throw
DoctrineException
::
incompleteQueryBuilder
();
}
$dql
=
''
;
switch
(
$this
->
_type
)
{
...
...
@@ -238,6 +234,24 @@ class QueryBuilder
return
$this
->
_q
;
}
/**
* Get the root alias for the query. This is the first entity alias involved
* in the construction of the query
*
* [php]
* $qb = $em->createQueryBuilder()
* ->select('u')
* ->from('User', 'u');
*
* echo $qb->getRootAlias(); // u
*
* @return string $rootAlias
*/
public
function
getRootAlias
()
{
return
$this
->
_dqlParts
[
'from'
][
0
]
->
getAlias
();
}
/**
* Sets a query parameter.
*
...
...
@@ -373,7 +387,7 @@ class QueryBuilder
}
/**
*
Add to
the SELECT statement
*
Set
the SELECT statement
*
* [php]
* $qb = $em->createQueryBuilder()
...
...
@@ -393,6 +407,31 @@ class QueryBuilder
return
$this
;
}
return
$this
->
add
(
'select'
,
new
Expr\Select
(
$selects
),
false
);
}
/**
* Add to the SELECT statement
*
* [php]
* $qb = $em->createQueryBuilder()
* ->select('u')
* ->addSelect('p')
* ->from('User', 'u')
* ->leftJoin('u.Phonenumbers', 'p');
*
* @param mixed $select String SELECT statement or SELECT Expr instance
* @return QueryBuilder $qb
*/
public
function
addSelect
(
$select
=
null
)
{
$this
->
_type
=
self
::
SELECT
;
$selects
=
func_get_args
();
if
(
empty
(
$selects
))
{
return
$this
;
}
return
$this
->
add
(
'select'
,
new
Expr\Select
(
$selects
),
true
);
}
...
...
@@ -458,7 +497,7 @@ class QueryBuilder
*/
public
function
from
(
$from
,
$alias
=
null
)
{
return
$this
->
add
(
'from'
,
new
Expr\From
(
$from
,
$alias
));
return
$this
->
add
(
'from'
,
new
Expr\From
(
$from
,
$alias
)
,
true
);
}
/**
...
...
@@ -571,7 +610,7 @@ class QueryBuilder
*/
public
function
andWhere
(
$where
)
{
$where
=
$this
->
_getDqlQuery
Part
(
'where'
);
$where
=
$this
->
getDql
Part
(
'where'
);
$args
=
func_get_args
();
if
(
$where
instanceof
Expr\Andx
)
{
...
...
@@ -600,7 +639,7 @@ class QueryBuilder
*/
public
function
orWhere
(
$where
)
{
$where
=
$this
->
_getDqlQuery
Part
(
'where'
);
$where
=
$this
->
getDql
Part
(
'where'
);
$args
=
func_get_args
();
if
(
$where
instanceof
Expr\Orx
)
{
...
...
@@ -672,7 +711,7 @@ class QueryBuilder
*/
public
function
andHaving
(
$having
)
{
$having
=
$this
->
_getDqlQuery
Part
(
'having'
);
$having
=
$this
->
getDql
Part
(
'having'
);
$args
=
func_get_args
();
if
(
$having
instanceof
Expr\Andx
)
{
...
...
@@ -693,7 +732,7 @@ class QueryBuilder
*/
public
function
orHaving
(
$having
)
{
$having
=
$this
->
_getDqlQuery
Part
(
'having'
);
$having
=
$this
->
getDql
Part
(
'having'
);
$args
=
func_get_args
();
if
(
$having
instanceof
Expr\Orx
)
{
...
...
@@ -730,10 +769,31 @@ class QueryBuilder
return
$this
->
add
(
'orderBy'
,
new
Expr\OrderBy
(
$sort
,
$order
),
true
);
}
/**
* Get a DQL part or parts by the part name
*
* @param string $queryPartName
* @return mixed $queryPart
*/
public
function
getDqlPart
(
$queryPartName
)
{
return
$this
->
_dqlParts
[
$queryPartName
];
}
/**
* Get the full DQL parts array
*
* @return array $dqlParts
*/
public
function
getDqlParts
()
{
return
$this
->
_dqlParts
;
}
private
function
_getDqlForDelete
()
{
return
'DELETE'
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' '
))
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' '
,
'separator'
=>
', '
))
.
$this
->
_getReducedDqlQueryPart
(
'where'
,
array
(
'pre'
=>
' WHERE '
))
.
$this
->
_getReducedDqlQueryPart
(
'orderBy'
,
array
(
'pre'
=>
' ORDER BY '
,
'separator'
=>
', '
));
}
...
...
@@ -741,7 +801,7 @@ class QueryBuilder
private
function
_getDqlForUpdate
()
{
return
'UPDATE'
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' '
))
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' '
,
'separator'
=>
', '
))
.
$this
->
_getReducedDqlQueryPart
(
'set'
,
array
(
'pre'
=>
' SET '
,
'separator'
=>
', '
))
.
$this
->
_getReducedDqlQueryPart
(
'where'
,
array
(
'pre'
=>
' WHERE '
))
.
$this
->
_getReducedDqlQueryPart
(
'orderBy'
,
array
(
'pre'
=>
' ORDER BY '
,
'separator'
=>
', '
));
...
...
@@ -751,7 +811,7 @@ class QueryBuilder
{
return
'SELECT'
.
$this
->
_getReducedDqlQueryPart
(
'select'
,
array
(
'pre'
=>
' '
,
'separator'
=>
', '
))
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' FROM '
))
.
$this
->
_getReducedDqlQueryPart
(
'from'
,
array
(
'pre'
=>
' FROM '
,
'separator'
=>
', '
))
.
$this
->
_getReducedDqlQueryPart
(
'join'
,
array
(
'pre'
=>
' '
,
'separator'
=>
' '
))
.
$this
->
_getReducedDqlQueryPart
(
'where'
,
array
(
'pre'
=>
' WHERE '
))
.
$this
->
_getReducedDqlQueryPart
(
'groupBy'
,
array
(
'pre'
=>
' GROUP BY '
,
'separator'
=>
', '
))
...
...
@@ -761,7 +821,7 @@ class QueryBuilder
private
function
_getReducedDqlQueryPart
(
$queryPartName
,
$options
=
array
())
{
$queryPart
=
$this
->
_getDqlQuery
Part
(
$queryPartName
);
$queryPart
=
$this
->
getDql
Part
(
$queryPartName
);
if
(
empty
(
$queryPart
))
{
return
(
isset
(
$options
[
'empty'
])
?
$options
[
'empty'
]
:
''
);
...
...
@@ -772,13 +832,13 @@ class QueryBuilder
.
(
isset
(
$options
[
'post'
])
?
$options
[
'post'
]
:
''
);
}
p
rivate
function
_getDqlQueryPart
(
$queryPartName
)
p
ublic
function
__toString
(
)
{
return
$this
->
_dqlParts
[
$queryPartName
]
;
return
$this
->
getDql
()
;
}
public
function
__
toString
()
public
function
__
clone
()
{
return
$this
->
getDql
()
;
$this
->
_q
=
clone
$this
->
_q
;
}
}
\ No newline at end of file
lib/Doctrine/ORM/Tools/SchemaTool.php
View file @
968ebb80
...
...
@@ -511,8 +511,6 @@ class SchemaTool
$columnInfo
=
$column
;
$columnChanged
=
false
;
echo
$column
[
'name'
]
.
' '
;
// 1. check for nullability change
$columnInfo
[
'notnull'
]
=
(
!
isset
(
$columnInfo
[
'notnull'
]))
?
false
:
$columnInfo
[
'notnull'
];
...
...
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