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
fa75b7bf
Commit
fa75b7bf
authored
Jan 17, 2017
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mark commented types implicitly
parent
475097dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
0 deletions
+46
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+6
-0
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+16
-0
CommentedType.php
tests/Doctrine/Tests/Types/CommentedType.php
+24
-0
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
fa75b7bf
...
...
@@ -400,6 +400,12 @@ abstract class AbstractPlatform
$dbType
=
strtolower
(
$dbType
);
$this
->
doctrineTypeMapping
[
$dbType
]
=
$doctrineType
;
$doctrineType
=
Type
::
getType
(
$doctrineType
);
if
(
$doctrineType
->
requiresSQLCommentHint
(
$this
))
{
$this
->
markDoctrineTypeCommented
(
$doctrineType
);
}
}
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
fa75b7bf
...
...
@@ -13,6 +13,7 @@ use Doctrine\DBAL\Schema\Index;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\Types\CommentedType
;
abstract
class
AbstractPlatformTestCase
extends
\Doctrine\Tests\DbalTestCase
{
...
...
@@ -107,6 +108,21 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
_platform
->
registerDoctrineTypeMapping
(
'foo'
,
'bar'
);
}
/**
* @group DBAL-2594
*/
public
function
testRegistersCommentedDoctrineMappingTypeImplicitly
()
{
if
(
!
Type
::
hasType
(
'my_commented'
))
{
Type
::
addType
(
'my_commented'
,
CommentedType
::
class
);
}
$type
=
Type
::
getType
(
'my_commented'
);
$this
->
_platform
->
registerDoctrineTypeMapping
(
'foo'
,
'my_commented'
);
$this
->
assertTrue
(
$this
->
_platform
->
isCommentedDoctrineType
(
$type
));
}
/**
* @group DBAL-939
*
...
...
tests/Doctrine/Tests/Types/CommentedType.php
0 → 100644
View file @
fa75b7bf
<?php
namespace
Doctrine\Tests\Types
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\Type
;
class
CommentedType
extends
Type
{
public
function
getName
()
{
return
'my_commented'
;
}
public
function
getSQLDeclaration
(
array
$fieldDeclaration
,
AbstractPlatform
$platform
)
{
return
strtoupper
(
$this
->
getName
());
}
public
function
requiresSQLCommentHint
(
AbstractPlatform
$platform
)
{
return
true
;
}
}
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