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
case
Connection
::
TRANSACTION_SERIALIZABLE
:
return
'SERIALIZABLE'
;
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
*/
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
$this
->
_stmt
=
$stmt
;
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
}
if
(
!
isset
(
self
::
$_typeObjects
[
$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
]();
}
...
...
lib/Doctrine/ORM/Cache/ApcCache.php
View file @
43b67919
...
...
@@ -39,7 +39,7 @@ class ApcCache implements Cache
public
function
__construct
()
{
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
$this
->
_hydrators
[
$hydrationMode
]
=
new
\Doctrine\ORM\Internal\Hydration\NoneHydrator
(
$this
);
break
;
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
)
{
$this
->
_hydrators
[
$hydrationMode
]
=
$this
->
_hydrators
[
$hydrationMode
](
$this
);
...
...
@@ -596,7 +596,7 @@ class EntityManager
if
(
is_array
(
$conn
))
{
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$conn
,
$config
,
$eventManager
);
}
else
if
(
!
$conn
instanceof
Connection
)
{
throw
new
DoctrineException
(
"Invalid parameter '
$conn
'."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Invalid parameter '
$conn
'."
);
}
if
(
is_null
(
$config
))
{
...
...
lib/Doctrine/ORM/Export/ClassExporter.php
View file @
43b67919
...
...
@@ -121,7 +121,7 @@ class ClassExporter
$foreignKeyConstraints
[]
=
$constraint
;
}
else
if
(
$mapping
->
isOneToMany
()
&&
$mapping
->
isOwningSide
())
{
//... 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
())
{
//... create join table
$joinTableColumns
=
array
();
...
...
lib/Doctrine/ORM/Id/Assigned.php
View file @
43b67919
...
...
@@ -61,7 +61,7 @@ class Assigned extends AbstractIdGenerator
}
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
;
...
...
lib/Doctrine/ORM/Id/TableGenerator.php
View file @
43b67919
...
...
@@ -12,7 +12,7 @@ class TableGenerator extends AbstractIdGenerator
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
}
}
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 */
...
...
lib/Doctrine/ORM/Mapping/ClassMetadata.php
View file @
43b67919
...
...
@@ -389,7 +389,7 @@ final class ClassMetadata
public
function
getSingleIdReflectionProperty
()
{
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
]];
}
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
43b67919
...
...
@@ -48,7 +48,7 @@ class AnnotationDriver
// Evaluate DoctrineEntity annotation
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
);
...
...
@@ -109,7 +109,7 @@ class AnnotationDriver
// DoctrineOneToOne, DoctrineOneToMany, DoctrineManyToOne, DoctrineManyToMany
if
(
$columnAnnot
=
$property
->
getAnnotation
(
'DoctrineColumn'
))
{
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
[
'length'
]
=
$columnAnnot
->
length
;
...
...
lib/Doctrine/ORM/PersistentCollection.php
View file @
43b67919
...
...
@@ -127,7 +127,7 @@ final class PersistentCollection extends \Doctrine\Common\Collections\Collection
$this
->
_ownerClass
=
$em
->
getClassMetadata
(
$type
);
if
(
$keyField
!==
null
)
{
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
;
}
...
...
lib/Doctrine/ORM/Persisters/AbstractEntityPersister.php
View file @
43b67919
...
...
@@ -173,7 +173,7 @@ abstract class AbstractEntityPersister
$mapping
=
$this
->
_classMetadata
->
getFieldMapping
(
$fieldName
);
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
public
function
setResultCache
(
$resultCache
)
{
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.'
);
}
...
...
@@ -410,7 +410,7 @@ class Query extends AbstractQuery
public
function
setQueryCache
(
$queryCache
)
{
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.'
);
}
...
...
lib/Doctrine/ORM/Query/AST/ArithmeticExpression.php
View file @
43b67919
...
...
@@ -18,13 +18,13 @@ class ArithmeticExpression extends Node
public
function
setSimpleArithmeticExpression
(
$simpleArithmeticExpr
)
{
if
(
$this
->
_subselect
)
throw
new
Doctrine_Exception
;
if
(
$this
->
_subselect
)
throw
\Doctrine\Common\DoctrineException
::
updateMe
()
;
$this
->
_simpleArithmeticExpression
=
$simpleArithmeticExpr
;
}
public
function
setSubselect
(
$subselect
)
{
if
(
$this
->
_simpleArithmeticExpression
)
throw
new
Doctrine_Exception
;
if
(
$this
->
_simpleArithmeticExpression
)
throw
\Doctrine\Common\DoctrineException
::
updateMe
()
;
$this
->
_subselect
=
$subselect
;
}
...
...
lib/Doctrine/ORM/Query/Parser.php
View file @
43b67919
...
...
@@ -244,7 +244,7 @@ class Parser
$message
.=
"'
{
$this
->
_lexer
->
lookahead
[
'value'
]
}
'"
;
}
throw
new
QueryException
(
$message
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
$message
);
}
/**
...
...
@@ -259,7 +259,7 @@ class Parser
$token
=
$this
->
_lexer
->
token
;
}
//TODO: Include $token in $message
throw
new
QueryException
(
$message
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
$message
);
}
/**
...
...
@@ -1139,7 +1139,7 @@ class Parser
default
:
$this
->
syntaxError
();
}
throw
new
QueryException
(
"Not yet implemented."
);
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
//TODO...
}
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
43b67919
...
...
@@ -174,9 +174,9 @@ class SqlWalker
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
)
.
' AS '
.
$sqlTableAlias
.
'__'
.
$class
->
getColumnName
(
$fieldName
);
}
else
if
(
$pathExpression
->
isSimpleStateFieldAssociationPathExpression
())
{
throw
new
DoctrineException
(
"Not yet implemented."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
}
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
)
{
...
...
@@ -380,9 +380,9 @@ class SqlWalker
$sqlTableAlias
=
$this
->
_dqlToSqlAliasMap
[
$dqlAlias
];
$sql
.=
$sqlTableAlias
.
'.'
.
$class
->
getColumnName
(
$fieldName
);
}
else
if
(
$pathExpr
->
isSimpleStateFieldAssociationPathExpression
())
{
throw
new
DoctrineException
(
"Not yet implemented."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not yet implemented."
);
}
else
{
throw
new
DoctrineException
(
"Encountered invalid PathExpression during SQL construction."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
}
return
$sql
;
}
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
43b67919
...
...
@@ -470,7 +470,7 @@ class UnitOfWork
$this
->
_entityChangeSets
[
$oid
]
=
$changeSet
;
$this
->
_originalEntityData
[
$oid
]
=
$data
;
}
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
// during changeset calculation anyway, since they are in the identity map.
...
...
@@ -605,13 +605,13 @@ class UnitOfWork
$oid
=
spl_object_hash
(
$entity
);
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
]))
{
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
]))
{
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
;
...
...
@@ -642,11 +642,11 @@ class UnitOfWork
{
$oid
=
spl_object_hash
(
$entity
);
if
(
!
isset
(
$this
->
_entityIdentifiers
[
$oid
]))
{
throw
new
DoctrineException
(
"Entity without identity "
\Doctrine\Common\DoctrineException
::
updateMe
(
"Entity without identity "
.
"can't be registered as dirty."
);
}
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
]))
{
...
...
@@ -784,7 +784,7 @@ class UnitOfWork
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
spl_object_hash
(
$entity
)]);
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."
);
}
$className
=
$classMetadata
->
getRootClassName
();
...
...
@@ -827,7 +827,7 @@ class UnitOfWork
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
$this
->
getIdentifierHash
(
$this
->
_entityIdentifiers
[
$oid
]);
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."
);
}
$className
=
$classMetadata
->
getRootClassName
();
...
...
@@ -989,7 +989,7 @@ class UnitOfWork
$this
->
registerNew
(
$entity
);
break
;
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."
);
case
self
::
STATE_DELETED
:
// entity becomes managed again
...
...
@@ -1003,7 +1003,7 @@ class UnitOfWork
break
;
default
:
//TODO: throw UnitOfWorkException::invalidEntityState()
throw
new
DoctrineException
(
"Encountered invalid entity state."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
}
$this
->
_cascadeSave
(
$entity
,
$visited
,
$insertNow
);
}
...
...
@@ -1045,9 +1045,9 @@ class UnitOfWork
$this
->
registerDeleted
(
$entity
);
break
;
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
:
throw
new
DoctrineException
(
"Encountered invalid entity state."
);
\Doctrine\Common\DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
}
$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