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
dc3844e1
Commit
dc3844e1
authored
May 08, 2010
by
Christian Heinrich
Committed by
Roman S. Borschel
May 08, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #DDC-571
parent
ee04b31d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
IntegerType.php
lib/Doctrine/DBAL/Types/IntegerType.php
+3
-3
IntegerTest.php
tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
+6
-2
No files found.
lib/Doctrine/DBAL/Types/IntegerType.php
View file @
dc3844e1
...
...
@@ -25,7 +25,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* Type that maps an SQL INT to a PHP integer.
*
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
*/
...
...
@@ -43,9 +43,9 @@ class IntegerType extends Type
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
return
(
int
)
$value
;
return
(
null
===
$value
)
?
null
:
(
int
)
$value
;
}
public
function
getBindingType
()
{
return
\PDO
::
PARAM_INT
;
...
...
tests/Doctrine/Tests/DBAL/Types/IntegerTest.php
View file @
dc3844e1
...
...
@@ -6,7 +6,7 @@ use Doctrine\DBAL\Types\Type;
use
Doctrine\Tests\DBAL\Mocks
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
IntegerTest
extends
\Doctrine\Tests\DbalTestCase
{
protected
...
...
@@ -19,10 +19,14 @@ class IntegerTest extends \Doctrine\Tests\DbalTestCase
$this
->
_type
=
Type
::
getType
(
'integer'
);
}
public
function
test
Decimal
ConvertsToPHPValue
()
public
function
test
Integer
ConvertsToPHPValue
()
{
$this
->
assertTrue
(
is_integer
(
$this
->
_type
->
convertToPHPValue
(
'1'
,
$this
->
_platform
))
);
$this
->
assertTrue
(
is_null
(
$this
->
_type
->
convertToPHPValue
(
null
,
$this
->
_platform
))
);
}
}
\ No newline at end of file
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