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
43b67919
Commit
43b67919
authored
Feb 19, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] More replacing of old style of exceptions to intermediate step
parent
5582f07b
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
90 additions
and
39 deletions
+90
-39
ConnectionException.php
lib/Doctrine/DBAL/ConnectionException.php
+51
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+2
-2
Statement.php
lib/Doctrine/DBAL/Statement.php
+1
-1
Type.php
lib/Doctrine/DBAL/Types/Type.php
+1
-1
ApcCache.php
lib/Doctrine/ORM/Cache/ApcCache.php
+1
-1
EntityManager.php
lib/Doctrine/ORM/EntityManager.php
+2
-2
ClassExporter.php
lib/Doctrine/ORM/Export/ClassExporter.php
+1
-1
Assigned.php
lib/Doctrine/ORM/Id/Assigned.php
+1
-1
TableGenerator.php
lib/Doctrine/ORM/Id/TableGenerator.php
+1
-1
AbstractHydrator.php
lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
+1
-1
ClassMetadata.php
lib/Doctrine/ORM/Mapping/ClassMetadata.php
+1
-1
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+2
-2
PersistentCollection.php
lib/Doctrine/ORM/PersistentCollection.php
+1
-1
AbstractEntityPersister.php
lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php
+1
-1
Query.php
lib/Doctrine/ORM/Query.php
+2
-2
ArithmeticExpression.php
lib/Doctrine/ORM/Query/AST/ArithmeticExpression.php
+2
-2
Parser.php
lib/Doctrine/ORM/Query/Parser.php
+3
-3
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+4
-4
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+12
-12
No files found.
lib/Doctrine/DBAL/ConnectionException.php
0 → 100644
View file @
43b67919
<?php
/*
* $Id: Exception.php 4628 2008-07-04 16:32:19Z romanb $
*
* 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.doctrine-project.org>.
*/
namespace
Doctrine\DBAL
;
use
Doctrine\Common\DoctrineException
;
/**
* Doctrine\DBAL\ConnectionException
*
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision: 4628 $
* @author Jonathan H. Wage <jonwage@gmail.com
*/
class
ConnectionException
extends
DoctrineException
{
public
static
function
invalidPDOInstance
()
{
return
new
self
(
"Invalid PDO instance provided on connection creation."
);
}
public
static
function
driverRequired
()
{
return
new
self
(
"Please provide a driver or a driverClass to be able to start a Connection."
);
}
public
static
function
unknownDriver
(
$driver
)
{
return
new
self
(
"Unknown Connection driver '
$driver
'."
);
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
43b67919
...
@@ -1831,7 +1831,7 @@ abstract class AbstractPlatform
...
@@ -1831,7 +1831,7 @@ abstract class AbstractPlatform
case
Connection
::
TRANSACTION_SERIALIZABLE
:
case
Connection
::
TRANSACTION_SERIALIZABLE
:
return
'SERIALIZABLE'
;
return
'SERIALIZABLE'
;
default
:
default
:
throw
new
Doctrine_Common_Exceptions_DoctrineException
(
'isolation level is not supported: '
.
$isolation
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'isolation level is not supported: '
.
$isolation
);
}
}
}
}
...
@@ -1842,7 +1842,7 @@ abstract class AbstractPlatform
...
@@ -1842,7 +1842,7 @@ abstract class AbstractPlatform
*/
*/
public
function
getSetTransactionIsolationSql
(
$level
)
public
function
getSetTransactionIsolationSql
(
$level
)
{
{
throw
new
DoctrineException
(
'Set transaction isolation not supported by this platform.'
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'Set transaction isolation not supported by this platform.'
);
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Statement.php
View file @
43b67919
...
@@ -57,7 +57,7 @@ class Statement
...
@@ -57,7 +57,7 @@ class Statement
$this
->
_stmt
=
$stmt
;
$this
->
_stmt
=
$stmt
;
if
(
$stmt
===
false
)
{
if
(
$stmt
===
false
)
{
throw
new
DoctrineException
(
'Unknown statement object given.'
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'Unknown statement object given.'
);
}
}
}
}
...
...
lib/Doctrine/DBAL/Types/Type.php
View file @
43b67919
...
@@ -55,7 +55,7 @@ abstract class Type
...
@@ -55,7 +55,7 @@ abstract class Type
}
}
if
(
!
isset
(
self
::
$_typeObjects
[
$name
]))
{
if
(
!
isset
(
self
::
$_typeObjects
[
$name
]))
{
if
(
!
isset
(
self
::
$_typesMap
[
$name
]))
{
if
(
!
isset
(
self
::
$_typesMap
[
$name
]))
{
throw
new
DoctrineException
(
"Unknown type:
$name
"
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Unknown type:
$name
"
);
}
}
self
::
$_typeObjects
[
$name
]
=
new
self
::
$_typesMap
[
$name
]();
self
::
$_typeObjects
[
$name
]
=
new
self
::
$_typesMap
[
$name
]();
}
}
...
...
lib/Doctrine/ORM/Cache/ApcCache.php
View file @
43b67919
...
@@ -39,7 +39,7 @@ class ApcCache implements Cache
...
@@ -39,7 +39,7 @@ class ApcCache implements Cache
public
function
__construct
()
public
function
__construct
()
{
{
if
(
!
extension_loaded
(
'apc'
))
{
if
(
!
extension_loaded
(
'apc'
))
{
throw
new
DoctrineException
(
'The apc extension must be loaded in order to use the ApcCache.'
);
\Doctrine\Common\DoctrineException
::
updateMe
(
'The apc extension must be loaded in order to use the ApcCache.'
);
}
}
}
}
...
...
lib/Doctrine/ORM/EntityManager.php
View file @
43b67919
...
@@ -561,7 +561,7 @@ class EntityManager
...
@@ -561,7 +561,7 @@ class EntityManager
$this
->
_hydrators
[
$hydrationMode
]
=
new
\Doctrine\ORM\Internal\Hydration\NoneHydrator
(
$this
);
$this
->
_hydrators
[
$hydrationMode
]
=
new
\Doctrine\ORM\Internal\Hydration\NoneHydrator
(
$this
);
break
;
break
;
default
:
default
:
throw
new
DoctrineException
(
"No hydrator found for hydration mode '
$hydrationMode
'."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"No hydrator found for hydration mode '
$hydrationMode
'."
);
}
}
}
else
if
(
$this
->
_hydrators
[
$hydrationMode
]
instanceof
Closure
)
{
}
else
if
(
$this
->
_hydrators
[
$hydrationMode
]
instanceof
Closure
)
{
$this
->
_hydrators
[
$hydrationMode
]
=
$this
->
_hydrators
[
$hydrationMode
](
$this
);
$this
->
_hydrators
[
$hydrationMode
]
=
$this
->
_hydrators
[
$hydrationMode
](
$this
);
...
@@ -596,7 +596,7 @@ class EntityManager
...
@@ -596,7 +596,7 @@ class EntityManager
if
(
is_array
(
$conn
))
{
if
(
is_array
(
$conn
))
{
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$conn
,
$config
,
$eventManager
);
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$conn
,
$config
,
$eventManager
);
}
else
if
(
!
$conn
instanceof
Connection
)
{
}
else
if
(
!
$conn
instanceof
Connection
)
{
throw
new
DoctrineException
(
"Invalid parameter '
$conn
'."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Invalid parameter '
$conn
'."
);
}
}
if
(
is_null
(
$config
))
{
if
(
is_null
(
$config
))
{
...
...
lib/Doctrine/ORM/Export/ClassExporter.php
View file @
43b67919
...
@@ -121,7 +121,7 @@ class ClassExporter
...
@@ -121,7 +121,7 @@ class ClassExporter
$foreignKeyConstraints
[]
=
$constraint
;
$foreignKeyConstraints
[]
=
$constraint
;
}
else
if
(
$mapping
->
isOneToMany
()
&&
$mapping
->
isOwningSide
())
{
}
else
if
(
$mapping
->
isOneToMany
()
&&
$mapping
->
isOwningSide
())
{
//... create join table, one-many through join table supported later
//... create join table, one-many through join table supported later
throw
new
DoctrineException
(
"Not yet implemented."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
}
else
if
(
$mapping
->
isManyToMany
()
&&
$mapping
->
isOwningSide
())
{
}
else
if
(
$mapping
->
isManyToMany
()
&&
$mapping
->
isOwningSide
())
{
//... create join table
//... create join table
$joinTableColumns
=
array
();
$joinTableColumns
=
array
();
...
...
lib/Doctrine/ORM/Id/Assigned.php
View file @
43b67919
...
@@ -61,7 +61,7 @@ class Assigned extends AbstractIdGenerator
...
@@ -61,7 +61,7 @@ class Assigned extends AbstractIdGenerator
}
}
if
(
!
$identifier
)
{
if
(
!
$identifier
)
{
throw
new
DoctrineException
(
"Entity of type '"
.
get_class
(
$entity
)
.
"' is missing an assigned ID."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Entity of type '"
.
get_class
(
$entity
)
.
"' is missing an assigned ID."
);
}
}
return
$identifier
;
return
$identifier
;
...
...
lib/Doctrine/ORM/Id/TableGenerator.php
View file @
43b67919
...
@@ -12,7 +12,7 @@ class TableGenerator extends AbstractIdGenerator
...
@@ -12,7 +12,7 @@ class TableGenerator extends AbstractIdGenerator
public
function
generate
(
$entity
)
public
function
generate
(
$entity
)
{
{
throw
new
\Exception
(
"Not implemented"
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not implemented"
);
}
}
}
}
...
...
lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
View file @
43b67919
...
@@ -353,7 +353,7 @@ abstract class AbstractHydrator
...
@@ -353,7 +353,7 @@ abstract class AbstractHydrator
}
}
}
}
throw
new
DoctrineException
(
"No field name found for column name '
$lcColumnName
' during hydration."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"No field name found for column name '
$lcColumnName
' during hydration."
);
}
}
/** Needed only temporarily until the new parser is ready */
/** Needed only temporarily until the new parser is ready */
...
...
lib/Doctrine/ORM/Mapping/ClassMetadata.php
View file @
43b67919
...
@@ -389,7 +389,7 @@ final class ClassMetadata
...
@@ -389,7 +389,7 @@ final class ClassMetadata
public
function
getSingleIdReflectionProperty
()
public
function
getSingleIdReflectionProperty
()
{
{
if
(
$this
->
_isIdentifierComposite
)
{
if
(
$this
->
_isIdentifierComposite
)
{
throw
new
DoctrineException
(
"getSingleIdReflectionProperty called on entity with composite key."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"getSingleIdReflectionProperty called on entity with composite key."
);
}
}
return
$this
->
_reflectionProperties
[
$this
->
_identifier
[
0
]];
return
$this
->
_reflectionProperties
[
$this
->
_identifier
[
0
]];
}
}
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
43b67919
...
@@ -48,7 +48,7 @@ class AnnotationDriver
...
@@ -48,7 +48,7 @@ class AnnotationDriver
// Evaluate DoctrineEntity annotation
// Evaluate DoctrineEntity annotation
if
((
$entityAnnot
=
$annotClass
->
getAnnotation
(
'DoctrineEntity'
))
===
false
)
{
if
((
$entityAnnot
=
$annotClass
->
getAnnotation
(
'DoctrineEntity'
))
===
false
)
{
throw
new
MappingException
(
"
$className
is no entity."
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"
$className
is no entity."
);
}
}
$metadata
->
setCustomRepositoryClass
(
$entityAnnot
->
repositoryClass
);
$metadata
->
setCustomRepositoryClass
(
$entityAnnot
->
repositoryClass
);
...
@@ -109,7 +109,7 @@ class AnnotationDriver
...
@@ -109,7 +109,7 @@ class AnnotationDriver
// DoctrineOneToOne, DoctrineOneToMany, DoctrineManyToOne, DoctrineManyToMany
// DoctrineOneToOne, DoctrineOneToMany, DoctrineManyToOne, DoctrineManyToMany
if
(
$columnAnnot
=
$property
->
getAnnotation
(
'DoctrineColumn'
))
{
if
(
$columnAnnot
=
$property
->
getAnnotation
(
'DoctrineColumn'
))
{
if
(
$columnAnnot
->
type
==
null
)
{
if
(
$columnAnnot
->
type
==
null
)
{
throw
new
MappingException
(
"Missing type on property "
.
$property
->
getName
());
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Missing type on property "
.
$property
->
getName
());
}
}
$mapping
[
'type'
]
=
$columnAnnot
->
type
;
$mapping
[
'type'
]
=
$columnAnnot
->
type
;
$mapping
[
'length'
]
=
$columnAnnot
->
length
;
$mapping
[
'length'
]
=
$columnAnnot
->
length
;
...
...
lib/Doctrine/ORM/PersistentCollection.php
View file @
43b67919
...
@@ -127,7 +127,7 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection
...
@@ -127,7 +127,7 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection
$this
->
_ownerClass
=
$em
->
getClassMetadata
(
$type
);
$this
->
_ownerClass
=
$em
->
getClassMetadata
(
$type
);
if
(
$keyField
!==
null
)
{
if
(
$keyField
!==
null
)
{
if
(
!
$this
->
_ownerClass
->
hasField
(
$keyField
))
{
if
(
!
$this
->
_ownerClass
->
hasField
(
$keyField
))
{
throw
new
DoctrineException
(
"Invalid field '
$keyField
' can't be used as key."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Invalid field '
$keyField
' can't be used as key."
);
}
}
$this
->
_keyField
=
$keyField
;
$this
->
_keyField
=
$keyField
;
}
}
...
...
lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php
View file @
43b67919
...
@@ -173,7 +173,7 @@ abstract class AbstractEntityPersister
...
@@ -173,7 +173,7 @@ abstract class AbstractEntityPersister
$mapping
=
$this
->
_classMetadata
->
getFieldMapping
(
$fieldName
);
$mapping
=
$this
->
_classMetadata
->
getFieldMapping
(
$fieldName
);
return
$mapping
[
'inherited'
];
return
$mapping
[
'inherited'
];
}
}
throw
new
DoctrineException
(
"Unable to find defining class of field '
$fieldName
'."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Unable to find defining class of field '
$fieldName
'."
);
}
}
/**
/**
...
...
lib/Doctrine/ORM/Query.php
View file @
43b67919
...
@@ -328,7 +328,7 @@ class Query extends AbstractQuery
...
@@ -328,7 +328,7 @@ class Query extends AbstractQuery
public
function
setResultCache
(
$resultCache
)
public
function
setResultCache
(
$resultCache
)
{
{
if
(
$resultCache
!==
null
&&
!
(
$resultCache
instanceof
\Doctrine\ORM\Cache\Cache
))
{
if
(
$resultCache
!==
null
&&
!
(
$resultCache
instanceof
\Doctrine\ORM\Cache\Cache
))
{
throw
new
DoctrineException
(
\Doctrine\Common\DoctrineException
::
updateMe
(
'Method setResultCache() accepts only an instance of Doctrine_Cache_Interface or null.'
'Method setResultCache() accepts only an instance of Doctrine_Cache_Interface or null.'
);
);
}
}
...
@@ -410,7 +410,7 @@ class Query extends AbstractQuery
...
@@ -410,7 +410,7 @@ class Query extends AbstractQuery
public
function
setQueryCache
(
$queryCache
)
public
function
setQueryCache
(
$queryCache
)
{
{
if
(
$queryCache
!==
null
&&
!
(
$queryCache
instanceof
\Doctrine\ORM\Cache\Cache
))
{
if
(
$queryCache
!==
null
&&
!
(
$queryCache
instanceof
\Doctrine\ORM\Cache\Cache
))
{
throw
new
DoctrineException
(
\Doctrine\Common\DoctrineException
::
updateMe
(
'Method setResultCache() accepts only an instance of Doctrine_ORM_Cache_Interface or null.'
'Method setResultCache() accepts only an instance of Doctrine_ORM_Cache_Interface or null.'
);
);
}
}
...
...
lib/Doctrine/ORM/Query/AST/ArithmeticExpression.php
View file @
43b67919
...
@@ -18,13 +18,13 @@ class ArithmeticExpression extends Node
...
@@ -18,13 +18,13 @@ class ArithmeticExpression extends Node
public
function
setSimpleArithmeticExpression
(
$simpleArithmeticExpr
)
public
function
setSimpleArithmeticExpression
(
$simpleArithmeticExpr
)
{
{
if
(
$this
->
_subselect
)
throw
new
Doctrine_Exception
;
if
(
$this
->
_subselect
)
throw
\Doctrine\Common\DoctrineException
::
updateMe
()
;
$this
->
_simpleArithmeticExpression
=
$simpleArithmeticExpr
;
$this
->
_simpleArithmeticExpression
=
$simpleArithmeticExpr
;
}
}
public
function
setSubselect
(
$subselect
)
public
function
setSubselect
(
$subselect
)
{
{
if
(
$this
->
_simpleArithmeticExpression
)
throw
new
Doctrine_Exception
;
if
(
$this
->
_simpleArithmeticExpression
)
throw
\Doctrine\Common\DoctrineException
::
updateMe
()
;
$this
->
_subselect
=
$subselect
;
$this
->
_subselect
=
$subselect
;
}
}
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
43b67919
...
@@ -244,7 +244,7 @@ class Parser
...
@@ -244,7 +244,7 @@ class Parser
$message
.=
"'
{
$this
->
_lexer
->
lookahead
[
'value'
]
}
'"
;
$message
.=
"'
{
$this
->
_lexer
->
lookahead
[
'value'
]
}
'"
;
}
}
throw
new
QueryException
(
$message
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
$message
);
}
}
/**
/**
...
@@ -259,7 +259,7 @@ class Parser
...
@@ -259,7 +259,7 @@ class Parser
$token
=
$this
->
_lexer
->
token
;
$token
=
$this
->
_lexer
->
token
;
}
}
//TODO: Include $token in $message
//TODO: Include $token in $message
throw
new
QueryException
(
$message
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
$message
);
}
}
/**
/**
...
@@ -1139,7 +1139,7 @@ class Parser
...
@@ -1139,7 +1139,7 @@ class Parser
default
:
default
:
$this
->
syntaxError
();
$this
->
syntaxError
();
}
}
throw
new
QueryException
(
"Not yet implemented."
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
//TODO...
//TODO...
}
}
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
43b67919
...
@@ -174,9 +174,9 @@ class SqlWalker
...
@@ -174,9 +174,9 @@ class SqlWalker
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
)
.
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
)
.
' AS '
.
$sqlTableAlias
.
'__'
.
$class
->
getColumnName
(
$fieldName
);
' AS '
.
$sqlTableAlias
.
'__'
.
$class
->
getColumnName
(
$fieldName
);
}
else
if
(
$pathExpression
->
isSimpleStateFieldAssociationPathExpression
())
{
}
else
if
(
$pathExpression
->
isSimpleStateFieldAssociationPathExpression
())
{
throw
new
DoctrineException
(
"Not yet implemented."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
}
else
{
}
else
{
throw
new
DoctrineException
(
"Encountered invalid PathExpression during SQL construction."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
}
}
}
}
else
if
(
$selectExpression
->
getExpression
()
instanceof
AST\AggregateExpression
)
{
else
if
(
$selectExpression
->
getExpression
()
instanceof
AST\AggregateExpression
)
{
...
@@ -380,9 +380,9 @@ class SqlWalker
...
@@ -380,9 +380,9 @@ class SqlWalker
$sqlTableAlias
=
$this
->
_dqlToSqlAliasMap
[
$dqlAlias
];
$sqlTableAlias
=
$this
->
_dqlToSqlAliasMap
[
$dqlAlias
];
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
);
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
);
}
else
if
(
$pathExpr
->
isSimpleStateFieldAssociationPathExpression
())
{
}
else
if
(
$pathExpr
->
isSimpleStateFieldAssociationPathExpression
())
{
throw
new
DoctrineException
(
"Not yet implemented."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
}
else
{
}
else
{
throw
new
DoctrineException
(
"Encountered invalid PathExpression during SQL construction."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
}
}
return
$sql
;
return
$sql
;
}
}
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
43b67919
...
@@ -470,7 +470,7 @@ class UnitOfWork
...
@@ -470,7 +470,7 @@ class UnitOfWork
$this
->
_entityChangeSets
[
$oid
]
=
$changeSet
;
$this
->
_entityChangeSets
[
$oid
]
=
$changeSet
;
$this
->
_originalEntityData
[
$oid
]
=
$data
;
$this
->
_originalEntityData
[
$oid
]
=
$data
;
}
else
if
(
$state
==
self
::
STATE_DELETED
)
{
}
else
if
(
$state
==
self
::
STATE_DELETED
)
{
throw
new
DoctrineException
(
"Deleted entity in collection detected during flush."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Deleted entity in collection detected during flush."
);
}
}
// MANAGED associated entities are already taken into account
// MANAGED associated entities are already taken into account
// during changeset calculation anyway, since they are in the identity map.
// during changeset calculation anyway, since they are in the identity map.
...
@@ -605,13 +605,13 @@ class UnitOfWork
...
@@ -605,13 +605,13 @@ class UnitOfWork
$oid
=
spl_object_hash
(
$entity
);
$oid
=
spl_object_hash
(
$entity
);
if
(
isset
(
$this
->
_entityUpdates
[
$oid
]))
{
if
(
isset
(
$this
->
_entityUpdates
[
$oid
]))
{
throw
new
DoctrineException
(
"Dirty object can't be registered as new."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Dirty object can't be registered as new."
);
}
}
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
throw
new
DoctrineException
(
"Removed object can't be registered as new."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Removed object can't be registered as new."
);
}
}
if
(
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
if
(
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
throw
new
DoctrineException
(
"Object already registered as new. Can't register twice."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Object already registered as new. Can't register twice."
);
}
}
$this
->
_entityInsertions
[
$oid
]
=
$entity
;
$this
->
_entityInsertions
[
$oid
]
=
$entity
;
...
@@ -642,11 +642,11 @@ class UnitOfWork
...
@@ -642,11 +642,11 @@ class UnitOfWork
{
{
$oid
=
spl_object_hash
(
$entity
);
$oid
=
spl_object_hash
(
$entity
);
if
(
!
isset
(
$this
->
_entityIdentifiers
[
$oid
]))
{
if
(
!
isset
(
$this
->
_entityIdentifiers
[
$oid
]))
{
throw
new
DoctrineException
(
"Entity without identity "
\Doctrine\Common\DoctrineException
::
updateMe
(
"Entity without identity "
.
"can't be registered as dirty."
);
.
"can't be registered as dirty."
);
}
}
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
throw
new
DoctrineException
(
"Removed object can't be registered as dirty."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Removed object can't be registered as dirty."
);
}
}
if
(
!
isset
(
$this
->
_entityUpdates
[
$oid
])
&&
!
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
if
(
!
isset
(
$this
->
_entityUpdates
[
$oid
])
&&
!
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
...
@@ -784,7 +784,7 @@ class UnitOfWork
...
@@ -784,7 +784,7 @@ class UnitOfWork
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
spl_object_hash
(
$entity
)]);
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
spl_object_hash
(
$entity
)]);
if
(
$idHash
===
''
)
{
if
(
$idHash
===
''
)
{
throw
new
DoctrineException
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
\Doctrine\Common\DoctrineException
::
updateMe
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
.
"' has no identity and therefore can't be added to the identity map."
);
.
"' has no identity and therefore can't be added to the identity map."
);
}
}
$className
=
$classMetadata
->
getRootClassName
();
$className
=
$classMetadata
->
getRootClassName
();
...
@@ -827,7 +827,7 @@ class UnitOfWork
...
@@ -827,7 +827,7 @@ class UnitOfWork
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
$oid
]);
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
$oid
]);
if
(
$idHash
===
''
)
{
if
(
$idHash
===
''
)
{
throw
new
DoctrineException
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
\Doctrine\Common\DoctrineException
::
updateMe
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
.
"' has no identity and therefore can't be removed from the identity map."
);
.
"' has no identity and therefore can't be removed from the identity map."
);
}
}
$className
=
$classMetadata
->
getRootClassName
();
$className
=
$classMetadata
->
getRootClassName
();
...
@@ -989,7 +989,7 @@ class UnitOfWork
...
@@ -989,7 +989,7 @@ class UnitOfWork
$this
->
registerNew
(
$entity
);
$this
->
registerNew
(
$entity
);
break
;
break
;
case
self
::
STATE_DETACHED
:
case
self
::
STATE_DETACHED
:
throw
new
DoctrineException
(
"Behavior of save() for a detached entity "
\Doctrine\Common\DoctrineException
::
updateMe
(
"Behavior of save() for a detached entity "
.
"is not yet defined."
);
.
"is not yet defined."
);
case
self
::
STATE_DELETED
:
case
self
::
STATE_DELETED
:
// entity becomes managed again
// entity becomes managed again
...
@@ -1003,7 +1003,7 @@ class UnitOfWork
...
@@ -1003,7 +1003,7 @@ class UnitOfWork
break
;
break
;
default
:
default
:
//TODO: throw UnitOfWorkException::invalidEntityState()
//TODO: throw UnitOfWorkException::invalidEntityState()
throw
new
DoctrineException
(
"Encountered invalid entity state."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
}
}
$this
->
_cascadeSave
(
$entity
,
$visited
,
$insertNow
);
$this
->
_cascadeSave
(
$entity
,
$visited
,
$insertNow
);
}
}
...
@@ -1045,9 +1045,9 @@ class UnitOfWork
...
@@ -1045,9 +1045,9 @@ class UnitOfWork
$this
->
registerDeleted
(
$entity
);
$this
->
registerDeleted
(
$entity
);
break
;
break
;
case
self
::
STATE_DETACHED
:
case
self
::
STATE_DETACHED
:
throw
new
DoctrineException
(
"A detached entity can't be deleted."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"A detached entity can't be deleted."
);
default
:
default
:
throw
new
DoctrineException
(
"Encountered invalid entity state."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
}
}
$this
->
_cascadeDelete
(
$entity
,
$visited
);
$this
->
_cascadeDelete
(
$entity
,
$visited
);
}
}
...
...
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