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
c9041d60
Commit
c9041d60
authored
Jun 28, 2010
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DBAL-28 - Better error messages on SchemaException
parent
360bdf6f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
SchemaException.php
lib/Doctrine/DBAL/Schema/SchemaException.php
+9
-9
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+7
-7
No files found.
lib/Doctrine/DBAL/Schema/SchemaException.php
View file @
c9041d60
...
...
@@ -37,27 +37,27 @@ class SchemaException extends \Doctrine\DBAL\DBALException
* @param string $indexName
* @return SchemaException
*/
static
public
function
indexDoesNotExist
(
$indexName
)
static
public
function
indexDoesNotExist
(
$indexName
,
$table
)
{
return
new
self
(
"Index '
"
.
$indexName
.
"' does not exist
."
,
self
::
INDEX_DOESNT_EXIST
);
return
new
self
(
"Index '
$indexName
' does not exist on table '
$table
'
."
,
self
::
INDEX_DOESNT_EXIST
);
}
/**
* @param string $indexName
* @return SchemaException
*/
static
public
function
indexAlreadyExists
(
$indexName
)
static
public
function
indexAlreadyExists
(
$indexName
,
$table
)
{
return
new
self
(
"An index with name
$indexName
was already defined
."
,
self
::
INDEX_ALREADY_EXISTS
);
return
new
self
(
"An index with name
'
$indexName
' was already defined on table '
$table
'
."
,
self
::
INDEX_ALREADY_EXISTS
);
}
/**
* @param string $columnName
* @return SchemaException
*/
static
public
function
columnDoesNotExist
(
$columnName
)
static
public
function
columnDoesNotExist
(
$columnName
,
$table
)
{
return
new
self
(
"
An unknown column-name
$columnName
was given
."
,
self
::
COLUMN_DOESNT_EXIST
);
return
new
self
(
"
There is no column with name '
$columnName
' on table '
$table
'
."
,
self
::
COLUMN_DOESNT_EXIST
);
}
/**
...
...
@@ -105,12 +105,12 @@ class SchemaException extends \Doctrine\DBAL\DBALException
* @param string $fkName
* @return SchemaException
*/
static
public
function
foreignKeyDoesNotExist
(
$fkName
)
static
public
function
foreignKeyDoesNotExist
(
$fkName
,
$table
)
{
return
new
self
(
"There exists no foreign key with the name '
"
.
$fkName
.
"
'."
,
self
::
FOREIGNKEY_DOESNT_EXIST
);
return
new
self
(
"There exists no foreign key with the name '
$fkName
' on table '
$table
'."
,
self
::
FOREIGNKEY_DOESNT_EXIST
);
}
static
public
function
namedForeignKeyRequired
(
$localTable
,
$foreignKey
)
static
public
function
namedForeignKeyRequired
(
Table
$localTable
,
ForeignKeyConstraint
$foreignKey
)
{
return
new
self
(
"The performed schema operation on "
.
$localTable
->
getName
()
.
" requires a named foreign key, "
.
...
...
lib/Doctrine/DBAL/Schema/Table.php
View file @
c9041d60
...
...
@@ -220,7 +220,7 @@ class Table extends AbstractAsset
}
if
(
!
$this
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
}
}
$this
->
_addIndex
(
new
Index
(
$indexName
,
$columnNames
,
$isUnique
,
$isPrimary
));
...
...
@@ -336,7 +336,7 @@ class Table extends AbstractAsset
foreach
(
$foreignColumnNames
AS
$columnName
)
{
if
(
!
$foreignTable
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$foreignTable
->
getName
()
);
}
}
}
else
{
...
...
@@ -345,7 +345,7 @@ class Table extends AbstractAsset
foreach
(
$localColumnNames
AS
$columnName
)
{
if
(
!
$this
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
}
}
...
...
@@ -403,7 +403,7 @@ class Table extends AbstractAsset
$indexName
=
strtolower
(
$indexName
);
if
(
isset
(
$this
->
_indexes
[
$indexName
])
||
(
$this
->
_primaryKeyName
!=
false
&&
$index
->
isPrimary
()))
{
throw
SchemaException
::
indexAlreadyExists
(
$indexName
);
throw
SchemaException
::
indexAlreadyExists
(
$indexName
,
$this
->
_name
);
}
if
(
$index
->
isPrimary
())
{
...
...
@@ -453,7 +453,7 @@ class Table extends AbstractAsset
{
$constraintName
=
strtolower
(
$constraintName
);
if
(
!
$this
->
hasForeignKey
(
$constraintName
))
{
throw
SchemaException
::
foreignKeyDoesNotExist
(
$constraintName
);
throw
SchemaException
::
foreignKeyDoesNotExist
(
$constraintName
,
$this
->
_name
);
}
return
$this
->
_fkConstraints
[
$constraintName
];
...
...
@@ -507,7 +507,7 @@ class Table extends AbstractAsset
{
$columnName
=
strtolower
(
$columnName
);
if
(
!
$this
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
}
return
$this
->
_columns
[
$columnName
];
...
...
@@ -539,7 +539,7 @@ class Table extends AbstractAsset
{
$indexName
=
strtolower
(
$indexName
);
if
(
!
$this
->
hasIndex
(
$indexName
))
{
throw
SchemaException
::
indexDoesNotExist
(
$indexName
);
throw
SchemaException
::
indexDoesNotExist
(
$indexName
,
$this
->
_name
);
}
return
$this
->
_indexes
[
$indexName
];
}
...
...
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