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
f83fd8e9
Commit
f83fd8e9
authored
Aug 26, 2009
by
jwage
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Updating exceptions to use methods so that we can later provide better exception messages
parent
b17ad38e
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
101 additions
and
106 deletions
+101
-106
DoctrineException.php
lib/Doctrine/Common/DoctrineException.php
+8
-2
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+34
-34
MsSqlPlatform.php
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
+2
-2
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+8
-8
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+2
-2
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+3
-3
MsSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
+1
-1
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+2
-2
Type.php
lib/Doctrine/DBAL/Types/Type.php
+1
-1
AbstractQuery.php
lib/Doctrine/ORM/AbstractQuery.php
+1
-3
EntityManager.php
lib/Doctrine/ORM/EntityManager.php
+5
-5
EntityRepository.php
lib/Doctrine/ORM/EntityRepository.php
+2
-2
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
+2
-3
AnnotationDriver.php
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
+2
-2
XmlDriver.php
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
+1
-1
YamlDriver.php
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
+1
-1
Base.php
lib/Doctrine/ORM/Query/Expr/Base.php
+1
-1
SqlWalker.php
lib/Doctrine/ORM/Query/SqlWalker.php
+3
-7
Cli.php
lib/Doctrine/ORM/Tools/Cli.php
+1
-3
UnitOfWork.php
lib/Doctrine/ORM/UnitOfWork.php
+18
-20
No files found.
lib/Doctrine/Common/DoctrineException.php
View file @
f83fd8e9
...
...
@@ -61,9 +61,15 @@ class DoctrineException extends \Exception
* @param string $class Class name
* @throws DoctrineException
*/
public
static
function
notImplemented
(
$method
,
$class
)
public
static
function
notImplemented
(
$method
=
null
,
$class
=
null
)
{
return
new
self
(
"The method '
$method
' is not implemented in class '
$class
'."
);
if
(
$method
&&
$class
)
{
return
new
self
(
"The method '
$method
' is not implemented in class '
$class
'."
);
}
else
if
(
$method
&&
!
$class
)
{
return
new
self
(
$method
);
}
else
{
return
new
self
(
'Functionality is not implemented.'
);
}
}
/**
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
f83fd8e9
...
...
@@ -103,7 +103,7 @@ abstract class AbstractPlatform
*/
public
function
getRegexpExpression
()
{
throw
DoctrineException
::
updateMe
(
'Regular expression operator is not supported by this database driver.'
);
throw
DoctrineException
::
regularExpressionOperatorNotSupported
(
$this
);
}
/**
...
...
@@ -374,7 +374,7 @@ abstract class AbstractPlatform
$values
=
$this
->
getIdentifiers
(
$values
);
if
(
count
(
$values
)
==
0
)
{
throw
DoctrineException
::
updateMe
(
'Values array for IN operator should not be empty.'
);
throw
DoctrineException
::
valuesArrayForInOperatorInvalid
(
);
}
return
$column
.
' IN ('
.
implode
(
', '
,
$values
)
.
')'
;
}
...
...
@@ -532,7 +532,7 @@ abstract class AbstractPlatform
*/
public
function
getCreateSequenceSql
(
$sequenceName
,
$start
=
1
,
$allocationSize
=
1
)
{
throw
DoctrineException
::
updateMe
(
'Create sequence not supported by this driver.'
);
throw
DoctrineException
::
createSequenceNotSupported
(
$this
);
}
/**
...
...
@@ -586,7 +586,7 @@ abstract class AbstractPlatform
public
function
getCreateIndexSql
(
$table
,
$name
,
array
$definition
)
{
if
(
!
isset
(
$definition
[
'fields'
]))
{
throw
DoctrineException
::
updateMe
(
'You must specify an array of fields to create the index for'
);
throw
DoctrineException
::
indexFieldsArrayRequired
(
);
}
$type
=
''
;
...
...
@@ -596,7 +596,7 @@ abstract class AbstractPlatform
$type
=
strtoupper
(
$definition
[
'type'
])
.
' '
;
break
;
default
:
throw
DoctrineException
::
u
pdateMe
(
'Unknown index type '
.
$definition
[
'type'
]);
throw
DoctrineException
::
u
nknownIndexType
(
$definition
[
'type'
]);
}
}
...
...
@@ -652,7 +652,7 @@ abstract class AbstractPlatform
*/
public
function
getAlterTableSql
(
$name
,
array
$changes
,
$check
=
false
)
{
throw
DoctrineException
::
updateMe
(
'Alter table not supported by this driver.'
);
throw
DoctrineException
::
alterTableNotSupported
(
$this
);
}
/**
...
...
@@ -837,12 +837,12 @@ abstract class AbstractPlatform
if
(
strtolower
(
$definition
[
'type'
])
==
'unique'
)
{
$type
=
strtoupper
(
$definition
[
'type'
])
.
' '
;
}
else
{
throw
DoctrineException
::
u
pdateMe
(
'Unknown index type '
.
$definition
[
'type'
]);
throw
DoctrineException
::
u
nknownIndexType
(
$definition
[
'type'
]);
}
}
if
(
!
isset
(
$definition
[
'fields'
])
||
!
is_array
(
$definition
[
'fields'
]))
{
throw
DoctrineException
::
updateMe
(
'No index columns given.'
);
throw
DoctrineException
::
indexFieldsArrayRequired
(
);
}
$query
=
$type
.
'INDEX '
.
$name
;
...
...
@@ -898,7 +898,7 @@ abstract class AbstractPlatform
*/
public
function
getShowDatabasesSql
()
{
throw
DoctrineException
::
updateMe
(
'Show databases not supported by this driver.'
);
throw
DoctrineException
::
showDatabasesNotSupported
(
$this
);
}
/**
...
...
@@ -990,7 +990,7 @@ abstract class AbstractPlatform
return
$upper
;
break
;
default
:
throw
DoctrineException
::
u
pdateMe
(
'Unknown foreign key referential action \''
.
$upper
.
'\' given.'
);
throw
DoctrineException
::
u
nknownForeignKeyReferentialAction
(
$upper
);
}
}
...
...
@@ -1010,13 +1010,13 @@ abstract class AbstractPlatform
$sql
.=
'FOREIGN KEY ('
;
if
(
!
isset
(
$definition
[
'local'
]))
{
throw
DoctrineException
::
updateMe
(
'Local reference field missing from definition.'
);
throw
DoctrineException
::
localReferenceFieldMissing
(
);
}
if
(
!
isset
(
$definition
[
'foreign'
]))
{
throw
DoctrineException
::
updateMe
(
'Foreign reference field missing from definition.'
);
throw
DoctrineException
::
foreignReferenceFieldMissing
(
);
}
if
(
!
isset
(
$definition
[
'foreignTable'
]))
{
throw
DoctrineException
::
updateMe
(
'Foreign reference table missing from definition.'
);
throw
DoctrineException
::
foreignReferenceTableMissing
(
);
}
if
(
!
is_array
(
$definition
[
'local'
]))
{
...
...
@@ -1091,7 +1091,7 @@ abstract class AbstractPlatform
*/
public
function
getMatchPatternExpression
(
$pattern
,
$operator
=
null
,
$field
=
null
)
{
throw
DoctrineException
::
updateMe
(
"Method not implemented."
);
throw
DoctrineException
::
matchPatternExpressionNotSupported
(
$this
);
}
/**
...
...
@@ -1221,88 +1221,88 @@ abstract class AbstractPlatform
case
Connection
::
TRANSACTION_SERIALIZABLE
:
return
'SERIALIZABLE'
;
default
:
throw
DoctrineException
::
updateMe
(
'isolation level is not supported: '
.
$isolation
);
throw
DoctrineException
::
isolationLevelNotSupported
(
$isolation
);
}
}
public
function
getListDatabasesSql
()
{
throw
DoctrineException
::
updateMe
(
'List databases not supported by this driver.'
);
throw
DoctrineException
::
listDatabasesNotSupported
(
$this
);
}
public
function
getListFunctionsSql
()
{
throw
DoctrineException
::
updateMe
(
'List functions not supported by this driver.'
);
throw
DoctrineException
::
listFunctionsNotSupported
(
$this
);
}
public
function
getListTriggersSql
(
$table
=
null
)
{
throw
DoctrineException
::
updateMe
(
'List triggers not supported by this driver.'
);
throw
DoctrineException
::
listTriggersNotSupported
(
$this
);
}
public
function
getListSequencesSql
(
$database
)
{
throw
DoctrineException
::
updateMe
(
'List sequences not supported by this driver.'
);
throw
DoctrineException
::
listSequencesNotSupported
(
$this
);
}
public
function
getListTableConstraintsSql
(
$table
)
{
throw
DoctrineException
::
updateMe
(
'List table constraints not supported by this driver.'
);
throw
DoctrineException
::
listTableConstraintsNotSupported
(
$this
);
}
public
function
getListTableColumnsSql
(
$table
)
{
throw
DoctrineException
::
updateMe
(
'List table columns not supported by this driver.'
);
throw
DoctrineException
::
listTableColumnsNotSupported
(
$this
);
}
public
function
getListTablesSql
()
{
throw
DoctrineException
::
updateMe
(
'List tables not supported by this driver.'
);
throw
DoctrineException
::
listTablesNotSupported
(
$this
);
}
public
function
getListUsersSql
()
{
throw
DoctrineException
::
updateMe
(
'List users not supported by this driver.'
);
throw
DoctrineException
::
listUsersNotSupported
(
$this
);
}
public
function
getListViewsSql
()
{
throw
DoctrineException
::
updateMe
(
'List views not supported by this driver.'
);
throw
DoctrineException
::
listViewsNotSupported
(
$this
);
}
public
function
getListTableIndexesSql
(
$table
)
{
throw
DoctrineException
::
updateMe
(
'List table indexes not supported by this driver.'
);
throw
DoctrineException
::
listTableIndexesNotSupported
(
$this
);
}
public
function
getListTableForeignKeysSql
(
$table
)
{
throw
DoctrineException
::
updateMe
(
'List table foreign keys not supported by this driver.'
);
throw
DoctrineException
::
listTableForeignKeysNotSupported
(
$this
);
}
public
function
getCreateViewSql
(
$name
,
$sql
)
{
throw
DoctrineException
::
updateMe
(
'Create view not supported by this driver'
);
throw
DoctrineException
::
createViewNotSupported
(
$this
);
}
public
function
getDropViewSql
(
$name
)
{
throw
DoctrineException
::
updateMe
(
'Drop view not supported by this driver'
);
throw
DoctrineException
::
dropViewNotSupported
(
$this
);
}
public
function
getDropSequenceSql
(
$sequenceName
)
{
throw
DoctrineException
::
updateMe
(
'Drop sequence not supported by this driver.'
);
throw
DoctrineException
::
dropSequenceNotSupported
(
$this
);
}
public
function
getSequenceNextValSql
(
$sequenceName
)
{
throw
DoctrineException
::
updateMe
(
'Sequences not supported by this driver.'
);
throw
DoctrineException
::
sequenceNotSupported
(
$this
);
}
public
function
getCreateDatabaseSql
(
$database
)
{
throw
DoctrineException
::
updateMe
(
'Create database not supported by this driver.'
);
throw
DoctrineException
::
createDatabaseNotSupported
(
$this
);
}
/**
...
...
@@ -1312,7 +1312,7 @@ abstract class AbstractPlatform
*/
public
function
getSetTransactionIsolationSql
(
$level
)
{
throw
DoctrineException
::
updateMe
(
'Set transaction isolation not supported by this platform.'
);
throw
DoctrineException
::
setTransactionIsolationLevelNotSupported
(
$this
);
}
/**
...
...
@@ -1325,7 +1325,7 @@ abstract class AbstractPlatform
*/
public
function
getCharsetFieldDeclaration
(
$charset
)
{
throw
DoctrineException
::
updateMe
(
'Get charset field declaration not supported by this platform.'
);
throw
DoctrineException
::
getCharsetFieldDeclarationNotSupported
(
$this
);
}
/**
...
...
@@ -1337,7 +1337,7 @@ abstract class AbstractPlatform
*/
public
function
getDateTimeTypeDeclarationSql
(
array
$fieldDeclaration
)
{
throw
DoctrineException
::
updateMe
(
'Get datetime type declaration not supported by this platform.'
);
throw
DoctrineException
::
getDateTimeTypeDeclarationNotSupported
(
$this
);
}
/**
...
...
lib/Doctrine/DBAL/Platforms/MsSqlPlatform.php
View file @
f83fd8e9
...
...
@@ -59,7 +59,7 @@ class MsSqlPlatform extends AbstractPlatform
$offset
=
intval
(
$offset
);
if
(
$offset
<
0
)
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"LIMIT argument offset=
$offset
is not valid"
);
throw
\Doctrine\Common\DoctrineException
::
limitOffsetInvalid
(
$offset
);
}
$orderby
=
stristr
(
$query
,
'ORDER BY'
);
...
...
@@ -99,7 +99,7 @@ class MsSqlPlatform extends AbstractPlatform
case
'name'
:
break
;
default
:
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'alterTable: change type "'
.
$changeName
.
'" not yet supported'
);
throw
\Doctrine\Common\DoctrineException
::
alterTableChangeNotSupported
(
$changeName
);
}
}
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
f83fd8e9
...
...
@@ -104,7 +104,7 @@ class MySqlPlatform extends AbstractPlatform
$match
=
$field
.
'LIKE BINARY '
;
break
;
default
:
throw
DoctrineException
::
updateMe
(
'not a supported operator type:'
.
$operator
);
throw
DoctrineException
::
operatorNotSupported
(
$operator
);
}
}
$match
.=
"'"
;
...
...
@@ -400,10 +400,10 @@ class MySqlPlatform extends AbstractPlatform
public
function
getCreateTableSql
(
$name
,
array
$fields
,
array
$options
=
array
())
{
if
(
!
$name
)
{
throw
DoctrineException
::
updateMe
(
'no valid table name specified'
);
throw
DoctrineException
::
missingTableName
(
);
}
if
(
empty
(
$fields
))
{
throw
DoctrineException
::
updateMe
(
'no fields specified for table "'
.
$name
.
'"'
);
throw
DoctrineException
::
missingFieldsArrayForTable
(
$name
);
}
$queryFields
=
$this
->
getColumnDeclarationListSql
(
$fields
);
...
...
@@ -591,7 +591,7 @@ class MySqlPlatform extends AbstractPlatform
public
function
getAlterTableSql
(
$name
,
array
$changes
,
$check
=
false
)
{
if
(
!
$name
)
{
throw
DoctrineException
::
updateMe
(
'no valid table name specified'
);
throw
DoctrineException
::
missingTableName
(
);
}
foreach
(
$changes
as
$changeName
=>
$change
)
{
...
...
@@ -603,7 +603,7 @@ class MySqlPlatform extends AbstractPlatform
case
'name'
:
break
;
default
:
throw
DoctrineException
::
updateMe
(
'change type "'
.
$changeName
.
'" not yet supported'
);
throw
\Doctrine\Common\DoctrineException
::
alterTableChangeNotSupported
(
$changeName
);
}
}
...
...
@@ -749,12 +749,12 @@ class MySqlPlatform extends AbstractPlatform
$type
=
strtoupper
(
$definition
[
'type'
])
.
' '
;
break
;
default
:
throw
DoctrineException
::
updateMe
(
'Unknown index type '
.
$definition
[
'type'
]);
throw
DoctrineException
::
invalidIndexType
(
$definition
[
'type'
]);
}
}
if
(
!
isset
(
$definition
[
'fields'
]))
{
throw
DoctrineException
::
updateMe
(
'No index columns given.'
);
throw
DoctrineException
::
indexFieldsArrayRequired
(
);
}
if
(
!
is_array
(
$definition
[
'fields'
]))
{
$definition
[
'fields'
]
=
array
(
$definition
[
'fields'
]);
...
...
@@ -794,7 +794,7 @@ class MySqlPlatform extends AbstractPlatform
$fieldString
.=
' '
.
$sort
;
break
;
default
:
throw
DoctrineException
::
u
pdateMe
(
'Unknown index sorting option given.'
);
throw
DoctrineException
::
u
nknownIndexSortingOption
(
$sort
);
}
}
}
else
{
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
f83fd8e9
...
...
@@ -389,7 +389,7 @@ END;';
public
function
getAlterTableSql
(
$name
,
array
$changes
,
$check
=
false
)
{
if
(
!
$name
)
{
throw
DoctrineException
::
updateMe
(
'no valid table name specified'
);
throw
DoctrineException
::
missingTableName
(
);
}
foreach
(
$changes
as
$changeName
=>
$change
)
{
switch
(
$changeName
)
{
...
...
@@ -400,7 +400,7 @@ END;';
case
'rename'
:
break
;
default
:
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'change type "'
.
$changeName
.
'" not yet supported'
);
throw
\Doctrine\Common\DoctrineException
::
alterTableChangeNotSupported
(
$changeName
);
}
}
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
f83fd8e9
...
...
@@ -194,7 +194,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$match
=
$field
.
'LIKE '
;
break
;
default
:
throw
DoctrineException
::
updateMe
(
'not a supported operator type:'
.
$operator
);
throw
DoctrineException
::
operatorNotSupported
(
$operator
);
}
}
$match
.=
"'"
;
...
...
@@ -506,7 +506,7 @@ class PostgreSqlPlatform extends AbstractPlatform
case
'rename'
:
break
;
default
:
throw
DoctrineException
::
updateMe
(
'change type "'
.
$changeName
.
'\" not yet supported'
);
throw
DoctrineException
::
alterTableChangeNotSupported
(
$changeName
);
}
}
...
...
@@ -536,7 +536,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$serverInfo
=
$this
->
getServerVersion
();
if
(
is_array
(
$serverInfo
)
&&
$serverInfo
[
'major'
]
<
8
)
{
throw
DoctrineException
::
updateMe
(
'changing column type for "'
.
$field
[
'type'
]
.
'\" requires PostgreSQL 8.0 or above'
);
throw
DoctrineException
::
changeColumnRequiresPostgreSQL8OrAbove
(
$field
[
'type'
]
);
}
$query
=
'ALTER '
.
$fieldName
.
' TYPE '
.
$this
->
getTypeDeclarationSql
(
$field
[
'definition'
]);
$sql
[]
=
'ALTER TABLE '
.
$name
.
' '
.
$query
;
...
...
lib/Doctrine/DBAL/Schema/MsSqlSchemaManager.php
View file @
f83fd8e9
...
...
@@ -160,7 +160,7 @@ class MsSqlSchemaManager extends AbstractSchemaManager
case
'rename'
:
case
'change'
:
default
:
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'alterTable: change type "'
.
$changeName
.
'" not yet supported'
);
throw
\Doctrine\Common\DoctrineException
::
alterTableChangeNotSupported
(
$changeName
);
}
}
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
f83fd8e9
...
...
@@ -318,7 +318,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
$res
=
$this
->
_conn
->
exec
(
$query
);
}
catch
(
Doctrine\DBAL\ConnectionException
$e
)
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'could not create sequence table'
);
throw
\Doctrine\Common\DoctrineException
::
createSequenceFailed
(
$query
);
}
if
(
$start
==
1
)
{
...
...
@@ -334,7 +334,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
try
{
$res
=
$this
->
_conn
->
exec
(
'DROP TABLE '
.
$sequenceName
);
}
catch
(
\Exception
$e
)
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'could not drop inconsistent sequence table'
);
throw
\Doctrine\Common\DoctrineException
::
couldNotDropSequenceTable
(
$sequenceName
);
}
return
$res
;
...
...
lib/Doctrine/DBAL/Types/Type.php
View file @
f83fd8e9
...
...
@@ -122,7 +122,7 @@ abstract class Type
{
if
(
!
isset
(
self
::
$_typeObjects
[
$name
]))
{
if
(
!
isset
(
self
::
$_typesMap
[
$name
]))
{
throw
DoctrineException
::
u
pdateMe
(
"Unknown type:
$name
"
);
throw
DoctrineException
::
u
nknownColumnType
(
$name
);
}
self
::
$_typeObjects
[
$name
]
=
new
self
::
$_typesMap
[
$name
]();
...
...
lib/Doctrine/ORM/AbstractQuery.php
View file @
f83fd8e9
...
...
@@ -207,9 +207,7 @@ abstract class AbstractQuery
public
function
setResultCache
(
$resultCache
=
null
)
{
if
(
$resultCache
!==
null
&&
!
(
$resultCache
instanceof
\Doctrine\Common\Cache\Cache
))
{
throw
DoctrineException
::
updateMe
(
'Method setResultCache() accepts only an instance of Doctrine_Cache_Interface or null.'
);
throw
DoctrineException
::
invalidResultCacheObject
(
$resultCache
);
}
$this
->
_resultCache
=
$resultCache
;
return
$this
;
...
...
lib/Doctrine/ORM/EntityManager.php
View file @
f83fd8e9
...
...
@@ -357,7 +357,7 @@ class EntityManager
$this
->
_unitOfWork
->
clear
();
}
else
{
//TODO
throw
DoctrineException
::
notImplemented
();
throw
DoctrineException
::
notImplemented
(
__FUNCTION__
,
__CLASS__
);
}
}
...
...
@@ -454,7 +454,7 @@ class EntityManager
*/
public
function
copy
(
$entity
,
$deep
=
false
)
{
throw
DoctrineException
::
notImplemented
();
throw
DoctrineException
::
notImplemented
(
__FUNCTION__
,
__CLASS__
);
}
/**
...
...
@@ -557,7 +557,7 @@ class EntityManager
$this
->
_hydrators
[
$hydrationMode
]
=
new
Internal\Hydration\SingleScalarHydrator
(
$this
);
break
;
default
:
throw
DoctrineException
::
updateMe
(
"No hydrator found for hydration mode '
$hydrationMode
'."
);
throw
DoctrineException
::
invalidHydrationMode
(
$hydrationMode
);
}
}
return
$this
->
_hydrators
[
$hydrationMode
];
...
...
@@ -591,10 +591,10 @@ class EntityManager
$conn
=
\Doctrine\DBAL\DriverManager
::
getConnection
(
$conn
,
$config
,
(
$eventManager
?:
new
EventManager
()));
}
else
if
(
$conn
instanceof
Connection
)
{
if
(
$eventManager
!==
null
&&
$conn
->
getEventManager
()
!==
$eventManager
)
{
throw
DoctrineException
::
updateMe
(
"Cannot use different EventManagers for EntityManager and Connection."
);
throw
DoctrineException
::
invalidEventManager
(
'Cannot use different EventManagers for EntityManager and Connection.'
);
}
}
else
{
throw
DoctrineException
::
updateMe
(
"Invalid parameter '
$conn
'."
);
throw
DoctrineException
::
invalidParameter
(
$conn
);
}
return
new
EntityManager
(
$conn
,
$config
,
$conn
->
getEventManager
());
...
...
lib/Doctrine/ORM/EntityRepository.php
View file @
f83fd8e9
...
...
@@ -138,7 +138,7 @@ class EntityRepository
}
if
(
!
isset
(
$arguments
[
0
]))
{
throw
DoctrineException
::
updateMe
(
'You must specify the value to findBy.'
);
throw
DoctrineException
::
findByNameRequired
(
);
}
$fieldName
=
lcfirst
(
\Doctrine\Common\Util\Inflector
::
classify
(
$by
));
...
...
@@ -146,7 +146,7 @@ class EntityRepository
if
(
$this
->
_class
->
hasField
(
$fieldName
))
{
return
$this
->
$method
(
array
(
$fieldName
=>
$arguments
[
0
]));
}
else
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'Cannot find by: '
.
$by
.
'. Invalid field.'
);
throw
\Doctrine\Common\DoctrineException
::
invalidFindBy
(
$by
);
}
}
}
\ No newline at end of file
lib/Doctrine/ORM/Id/Assigned.php
View file @
f83fd8e9
...
...
@@ -62,7 +62,7 @@ class Assigned extends AbstractIdGenerator
}
if
(
!
$identifier
)
{
throw
DoctrineException
::
updateMe
(
"Entity of type '"
.
get_class
(
$entity
)
.
"' is missing an assigned ID."
);
throw
DoctrineException
::
entityMissingAssignedId
(
$entity
);
}
return
$identifier
;
...
...
lib/Doctrine/ORM/Id/TableGenerator.php
View file @
f83fd8e9
...
...
@@ -14,6 +14,6 @@ class TableGenerator extends AbstractIdGenerator
{
public
function
generate
(
EntityManager
$em
,
$entity
)
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Not implemented"
);
throw
\Doctrine\Common\DoctrineException
::
notImplemented
(
__CLASS__
.
'::'
.
__FUNCTION__
);
}
}
\ No newline at end of file
lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php
View file @
f83fd8e9
...
...
@@ -304,6 +304,6 @@ abstract class AbstractHydrator
}
}
throw
DoctrineException
::
updateMe
(
"No owner found for field '
$fieldName
' during hydration."
);
throw
DoctrineException
::
noOwnerFoundForField
(
$class
,
$fieldName
);
}
}
lib/Doctrine/ORM/Mapping/ClassMetadata.php
View file @
f83fd8e9
...
...
@@ -537,7 +537,7 @@ final class ClassMetadata
public
function
getSingleIdReflectionProperty
()
{
if
(
$this
->
isIdentifierComposite
)
{
throw
DoctrineException
::
updateMe
(
"getSingleIdReflectionProperty called on entity with composite key."
);
throw
DoctrineException
::
singleIdNotAllowedOnCompositePrimaryKey
(
);
}
return
$this
->
reflFields
[
$this
->
identifier
[
0
]];
}
...
...
@@ -830,8 +830,7 @@ final class ClassMetadata
public
function
getSingleIdentifierFieldName
()
{
if
(
$this
->
isIdentifierComposite
)
{
throw
DoctrineException
::
updateMe
(
"Calling getSingleIdentifierFieldName "
.
"on a class that uses a composite identifier is not allowed."
);
throw
DoctrineException
::
singleIdNotAllowedOnCompositePrimaryKey
();
}
return
$this
->
identifier
[
0
];
}
...
...
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php
View file @
f83fd8e9
...
...
@@ -67,7 +67,7 @@ class AnnotationDriver implements Driver
}
else
if
(
isset
(
$classAnnotations
[
'Doctrine\ORM\Mapping\MappedSuperclass'
]))
{
$metadata
->
isMappedSuperclass
=
true
;
}
else
{
throw
DoctrineException
::
updateMe
(
"
$className
is no entity or mapped superclass."
);
throw
DoctrineException
::
classIsNotAValidEntityOrMapperSuperClass
(
$className
);
}
// Evaluate DoctrineTable annotation
...
...
@@ -155,7 +155,7 @@ class AnnotationDriver implements Driver
// @Column, @OneToOne, @OneToMany, @ManyToOne, @ManyToMany
if
(
$columnAnnot
=
$this
->
_reader
->
getPropertyAnnotation
(
$property
,
'Doctrine\ORM\Mapping\Column'
))
{
if
(
$columnAnnot
->
type
==
null
)
{
throw
DoctrineException
::
updateMe
(
"Missing type on property "
.
$property
->
getName
());
throw
DoctrineException
::
propertyTypeIsRequired
(
$property
->
getName
());
}
$mapping
[
'type'
]
=
$columnAnnot
->
type
;
$mapping
[
'length'
]
=
$columnAnnot
->
length
;
...
...
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php
View file @
f83fd8e9
...
...
@@ -52,7 +52,7 @@ class XmlDriver extends AbstractFileDriver
}
else
if
(
$xmlRoot
->
getName
()
==
'mapped-superclass'
)
{
$metadata
->
isMappedSuperclass
=
true
;
}
else
{
throw
DoctrineException
::
updateMe
(
"
$className
is no entity or mapped superclass."
);
throw
DoctrineException
::
classIsNotAValidEntityOrMapperSuperClass
(
$className
);
}
// Evaluate <entity...> attributes
...
...
lib/Doctrine/ORM/Mapping/Driver/YamlDriver.php
View file @
f83fd8e9
...
...
@@ -53,7 +53,7 @@ class YamlDriver extends AbstractFileDriver
}
else
if
(
$element
[
'type'
]
==
'mappedSuperclass'
)
{
$metadata
->
isMappedSuperclass
=
true
;
}
else
{
throw
DoctrineException
::
updateMe
(
"
$className
is no entity or mapped superclass."
);
throw
DoctrineException
::
classIsNotAValidEntityOrMapperSuperClass
(
$className
);
}
// Evaluate root level properties
...
...
lib/Doctrine/ORM/Query/Expr/Base.php
View file @
f83fd8e9
...
...
@@ -60,7 +60,7 @@ abstract class Base
$class
=
get_class
(
$arg
);
if
(
!
in_array
(
$class
,
$this
->
_allowedClasses
))
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
"Class '
{
$class
}
' is not allowed in "
.
get_class
(
$this
)
.
" instance."
);
throw
\Doctrine\Common\DoctrineException
::
classNotAllowed
(
$class
,
$this
);
}
}
...
...
lib/Doctrine/ORM/Query/SqlWalker.php
View file @
f83fd8e9
...
...
@@ -421,12 +421,10 @@ class SqlWalker implements TreeWalker
break
;
case
AST\PathExpression
::
TYPE_COLLECTION_VALUED_ASSOCIATION
:
throw
DoctrineException
::
updateMe
(
"Not yet implemented."
);
throw
DoctrineException
::
notImplemented
(
);
default
:
throw
DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
throw
DoctrineException
::
invalidPathExpression
(
$pathExpr
->
type
);
}
return
$sql
;
...
...
@@ -753,9 +751,7 @@ class SqlWalker implements TreeWalker
$columnAlias
=
$this
->
_platform
->
getSqlResultCasing
(
$columnAlias
);
$this
->
_rsm
->
addFieldResult
(
$dqlAlias
,
$columnAlias
,
$fieldName
);
}
else
{
throw
DoctrineException
::
updateMe
(
"Encountered invalid PathExpression during SQL construction."
);
throw
DoctrineException
::
invalidPathExpression
(
$expr
->
type
);
}
}
else
if
(
$expr
instanceof
AST\AggregateExpression
)
{
if
(
!
$selectExpression
->
fieldIdentificationVariable
)
{
...
...
lib/Doctrine/ORM/Tools/Cli.php
View file @
f83fd8e9
...
...
@@ -176,9 +176,7 @@ class Cli
$task
->
basicHelp
();
// Fallback of not-valid task arguments
}
}
else
{
throw
\Doctrine\Common\DoctrineException
::
updateMe
(
'Unexistent task or attached task class does not exist.'
);
throw
\Doctrine\Common\DoctrineException
::
taskDoesNotExist
(
$taskName
);
}
}
}
catch
(
\Doctrine\Common\DoctrineException
$e
)
{
...
...
lib/Doctrine/ORM/UnitOfWork.php
View file @
f83fd8e9
...
...
@@ -580,8 +580,7 @@ class UnitOfWork implements PropertyChangedListener
$this
->
_entityChangeSets
[
$oid
]
=
$changeSet
;
$this
->
_originalEntityData
[
$oid
]
=
$data
;
}
else
if
(
$state
==
self
::
STATE_REMOVED
)
{
throw
DoctrineException
::
updateMe
(
"Removed entity in collection detected during flush."
.
" Make sure you properly remove deleted entities from collections."
);
throw
DoctrineException
::
removedEntityInCollectionDetected
();
}
// MANAGED associated entities are already taken into account
// during changeset calculation anyway, since they are in the identity map.
...
...
@@ -819,13 +818,13 @@ class UnitOfWork implements PropertyChangedListener
$oid
=
spl_object_hash
(
$entity
);
if
(
isset
(
$this
->
_entityUpdates
[
$oid
]))
{
throw
DoctrineException
::
updateMe
(
"Dirty object can't be registered as new."
);
throw
DoctrineException
::
dirtyObjectCannotBeRegisteredAsNew
(
);
}
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
throw
DoctrineException
::
updateMe
(
"Removed object can't be registered as new."
);
throw
DoctrineException
::
removedObjectCannotBeRegisteredAsNew
(
);
}
if
(
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
throw
DoctrineException
::
updateMe
(
"Object already registered as new. Can't register twice."
);
throw
DoctrineException
::
objectAlreadyRegisteredAsNew
(
);
}
$this
->
_entityInsertions
[
$oid
]
=
$entity
;
...
...
@@ -855,11 +854,10 @@ class UnitOfWork implements PropertyChangedListener
{
$oid
=
spl_object_hash
(
$entity
);
if
(
!
isset
(
$this
->
_entityIdentifiers
[
$oid
]))
{
throw
DoctrineException
::
updateMe
(
"Entity without identity "
.
"can't be registered as dirty."
);
throw
DoctrineException
::
entityWithoutIdentityCannotBeRegisteredAsDirty
();
}
if
(
isset
(
$this
->
_entityDeletions
[
$oid
]))
{
throw
DoctrineException
::
updateMe
(
"Removed object can't be registered as dirty."
);
throw
DoctrineException
::
removedObjectCannotBeRegisteredAsDirty
(
);
}
if
(
!
isset
(
$this
->
_entityUpdates
[
$oid
])
&&
!
isset
(
$this
->
_entityInsertions
[
$oid
]))
{
...
...
@@ -961,8 +959,7 @@ class UnitOfWork implements PropertyChangedListener
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
implode
(
' '
,
$this
->
_entityIdentifiers
[
spl_object_hash
(
$entity
)]);
if
(
$idHash
===
''
)
{
throw
DoctrineException
::
updateMe
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
.
"' has no identity and therefore can't be added to the identity map."
);
throw
DoctrineException
::
entityMustHaveIdentifyToBeAddedToIdentityMap
(
$entity
);
}
$className
=
$classMetadata
->
rootEntityName
;
if
(
isset
(
$this
->
_identityMap
[
$className
][
$idHash
]))
{
...
...
@@ -1024,8 +1021,7 @@ class UnitOfWork implements PropertyChangedListener
$classMetadata
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$idHash
=
implode
(
' '
,
$this
->
_entityIdentifiers
[
$oid
]);
if
(
$idHash
===
''
)
{
throw
DoctrineException
::
updateMe
(
"Entity with oid '"
.
spl_object_hash
(
$entity
)
.
"' has no identity and therefore can't be removed from the identity map."
);
throw
DoctrineException
::
entityMustHaveIdentifyToBeRemovedFromIdentityMap
(
$entity
);
}
$className
=
$classMetadata
->
rootEntityName
;
if
(
isset
(
$this
->
_identityMap
[
$className
][
$idHash
]))
{
...
...
@@ -1131,8 +1127,9 @@ class UnitOfWork implements PropertyChangedListener
$visited
[
$oid
]
=
$entity
;
// Mark visited
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
switch
(
$this
->
getEntityState
(
$entity
,
self
::
STATE_NEW
))
{
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
$entityState
=
$this
->
getEntityState
(
$entity
,
self
::
STATE_NEW
);
switch
(
$entityState
)
{
case
self
::
STATE_MANAGED
:
// Nothing to do, except if policy is "deferred explicit"
if
(
$class
->
isChangeTrackingDeferredExplicit
())
{
...
...
@@ -1162,7 +1159,7 @@ class UnitOfWork implements PropertyChangedListener
$this
->
scheduleForInsert
(
$entity
);
break
;
case
self
::
STATE_DETACHED
:
throw
DoctrineException
::
updateMe
(
"Behavior of save() for a detached entity "
throw
DoctrineException
::
notImplemented
(
"Behavior of save() for a detached entity "
.
"is not yet defined."
);
case
self
::
STATE_REMOVED
:
// Entity becomes managed again
...
...
@@ -1174,7 +1171,7 @@ class UnitOfWork implements PropertyChangedListener
}
break
;
default
:
throw
DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
throw
DoctrineException
::
invalidEntityState
(
$entityState
);
}
$this
->
_cascadePersist
(
$entity
,
$visited
);
...
...
@@ -1211,7 +1208,8 @@ class UnitOfWork implements PropertyChangedListener
$visited
[
$oid
]
=
$entity
;
// mark visited
$class
=
$this
->
_em
->
getClassMetadata
(
get_class
(
$entity
));
switch
(
$this
->
getEntityState
(
$entity
))
{
$entityState
=
$this
->
getEntityState
(
$entity
);
switch
(
$entityState
)
{
case
self
::
STATE_NEW
:
case
self
::
STATE_REMOVED
:
// nothing to do
...
...
@@ -1226,11 +1224,11 @@ class UnitOfWork implements PropertyChangedListener
$this
->
scheduleForDelete
(
$entity
);
break
;
case
self
::
STATE_DETACHED
:
throw
new
\InvalidArgumentException
(
"A detached entity can not be removed."
);
throw
DoctrineException
::
detachedEntityCannotBeRemoved
(
);
default
:
throw
DoctrineException
::
updateMe
(
"Encountered invalid entity state."
);
throw
DoctrineException
::
invalidEntityState
(
$entityState
);
}
$this
->
_cascadeRemove
(
$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