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
5eb3e046
Commit
5eb3e046
authored
Sep 06, 2015
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#869 - DBAL-1293 - Preserving exceptions for invalid conversions
parent
a348e332
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
ConversionException.php
lib/Doctrine/DBAL/Types/ConversionException.php
+10
-7
DateIntervalType.php
lib/Doctrine/DBAL/Types/DateIntervalType.php
+2
-2
No files found.
lib/Doctrine/DBAL/Types/ConversionException.php
View file @
5eb3e046
...
...
@@ -41,7 +41,7 @@ class ConversionException extends \Doctrine\DBAL\DBALException
*/
static
public
function
conversionFailed
(
$value
,
$toType
)
{
$value
=
(
strlen
(
$value
)
>
32
)
?
substr
(
$value
,
0
,
20
)
.
"..."
:
$value
;
$value
=
(
strlen
(
$value
)
>
32
)
?
substr
(
$value
,
0
,
20
)
.
'...'
:
$value
;
return
new
self
(
'Could not convert database value "'
.
$value
.
'" to Doctrine Type '
.
$toType
);
}
...
...
@@ -50,19 +50,22 @@ class ConversionException extends \Doctrine\DBAL\DBALException
* Thrown when a Database to Doctrine Type Conversion fails and we can make a statement
* about the expected format.
*
* @param string $value
* @param string $toType
* @param string $expectedFormat
* @param string $value
* @param string $toType
* @param string $expectedFormat
* @param \Exception|null $previous
*
* @return \Doctrine\DBAL\Types\ConversionException
*/
static
public
function
conversionFailedFormat
(
$value
,
$toType
,
$expectedFormat
)
static
public
function
conversionFailedFormat
(
$value
,
$toType
,
$expectedFormat
,
\Exception
$previous
=
null
)
{
$value
=
(
strlen
(
$value
)
>
32
)
?
substr
(
$value
,
0
,
20
)
.
"..."
:
$value
;
$value
=
(
strlen
(
$value
)
>
32
)
?
substr
(
$value
,
0
,
20
)
.
'...'
:
$value
;
return
new
self
(
'Could not convert database value "'
.
$value
.
'" to Doctrine Type '
.
$toType
.
'. Expected format: '
.
$expectedFormat
$toType
.
'. Expected format: '
.
$expectedFormat
,
0
,
$previous
);
}
...
...
lib/Doctrine/DBAL/Types/DateIntervalType.php
View file @
5eb3e046
...
...
@@ -57,8 +57,8 @@ class DateIntervalType extends Type
try
{
$interval
=
new
\DateInterval
(
$value
);
}
catch
(
\Exception
$e
)
{
throw
ConversionException
::
conversionFailedFormat
(
$value
,
$this
->
getName
(),
'PY-m-dTH:i:s'
);
}
catch
(
\Exception
$e
xception
)
{
throw
ConversionException
::
conversionFailedFormat
(
$value
,
$this
->
getName
(),
'PY-m-dTH:i:s'
,
$exception
);
}
return
$interval
;
...
...
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