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
a94e26a3
Unverified
Commit
a94e26a3
authored
Aug 28, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2821 reverting BC break - moved static exception constructor to a new method to avoid API changes
parent
f01b7823
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
14 deletions
+17
-14
Connection.php
lib/Doctrine/DBAL/Connection.php
+1
-1
DBALException.php
lib/Doctrine/DBAL/DBALException.php
+12
-9
DBALExceptionTest.php
tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
+4
-4
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
a94e26a3
...
@@ -213,7 +213,7 @@ class Connection implements DriverConnection
...
@@ -213,7 +213,7 @@ class Connection implements DriverConnection
if
(
isset
(
$params
[
"platform"
]))
{
if
(
isset
(
$params
[
"platform"
]))
{
if
(
!
$params
[
'platform'
]
instanceof
Platforms\AbstractPlatform
)
{
if
(
!
$params
[
'platform'
]
instanceof
Platforms\AbstractPlatform
)
{
throw
DBALException
::
invalidPlatform
Specified
(
$params
[
'platform'
]);
throw
DBALException
::
invalidPlatform
Type
(
$params
[
'platform'
]);
}
}
$this
->
platform
=
$params
[
"platform"
];
$this
->
platform
=
$params
[
"platform"
];
...
...
lib/Doctrine/DBAL/DBALException.php
View file @
a94e26a3
...
@@ -36,21 +36,24 @@ class DBALException extends \Exception
...
@@ -36,21 +36,24 @@ class DBALException extends \Exception
return
new
self
(
"Operation '
$method
' is not supported by platform."
);
return
new
self
(
"Operation '
$method
' is not supported by platform."
);
}
}
public
static
function
invalidPlatformSpecified
()
:
self
{
return
new
self
(
"Invalid 'platform' option specified, need to give an instance of "
.
"\Doctrine\DBAL\Platforms\AbstractPlatform."
);
}
/**
/**
* Returns a new instance for an invalid platform specified.
* @param mixed $invalidPlatform
*
* @param mixed $invalidPlatform The invalid platform given.
*
* @return DBALException
*/
*/
public
static
function
invalidPlatform
Specified
(
$invalidPlatform
)
:
self
public
static
function
invalidPlatform
Type
(
$invalidPlatform
)
:
self
{
{
if
(
is_object
(
$invalidPlatform
))
{
if
(
\
is_object
(
$invalidPlatform
))
{
return
new
self
(
return
new
self
(
sprintf
(
sprintf
(
"Option 'platform' must be a subtype of '%s', instance of '%s' given"
,
"Option 'platform' must be a subtype of '%s', instance of '%s' given"
,
AbstractPlatform
::
class
,
AbstractPlatform
::
class
,
get_class
(
$invalidPlatform
)
\
get_class
(
$invalidPlatform
)
)
)
);
);
}
}
...
@@ -59,7 +62,7 @@ class DBALException extends \Exception
...
@@ -59,7 +62,7 @@ class DBALException extends \Exception
sprintf
(
sprintf
(
"Option 'platform' must be an object and subtype of '%s'. Got '%s'"
,
"Option 'platform' must be an object and subtype of '%s'. Got '%s'"
,
AbstractPlatform
::
class
,
AbstractPlatform
::
class
,
gettype
(
$invalidPlatform
)
\
gettype
(
$invalidPlatform
)
)
)
);
);
}
}
...
...
tests/Doctrine/Tests/DBAL/DBALExceptionTest.php
View file @
a94e26a3
...
@@ -62,9 +62,9 @@ class DBALExceptionTest extends DbalTestCase
...
@@ -62,9 +62,9 @@ class DBALExceptionTest extends DbalTestCase
/**
/**
* @group DBAL-2821
* @group DBAL-2821
*/
*/
public
function
testInvalidPlatform
Specified
Object
()
:
void
public
function
testInvalidPlatform
Type
Object
()
:
void
{
{
$exception
=
DBALException
::
invalidPlatform
Specified
(
new
\stdClass
());
$exception
=
DBALException
::
invalidPlatform
Type
(
new
\stdClass
());
self
::
assertSame
(
self
::
assertSame
(
"Option 'platform' must be a subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform', instance of 'stdClass' given"
,
"Option 'platform' must be a subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform', instance of 'stdClass' given"
,
...
@@ -75,9 +75,9 @@ class DBALExceptionTest extends DbalTestCase
...
@@ -75,9 +75,9 @@ class DBALExceptionTest extends DbalTestCase
/**
/**
* @group DBAL-2821
* @group DBAL-2821
*/
*/
public
function
testInvalidPlatform
Specified
Scalar
()
:
void
public
function
testInvalidPlatform
Type
Scalar
()
:
void
{
{
$exception
=
DBALException
::
invalidPlatform
Specified
(
"some string"
);
$exception
=
DBALException
::
invalidPlatform
Type
(
'some string'
);
self
::
assertSame
(
self
::
assertSame
(
"Option 'platform' must be an object and subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform'. Got 'string'"
,
"Option 'platform' must be an object and subtype of 'Doctrine\DBAL\Platforms\AbstractPlatform'. Got 'string'"
,
...
...
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