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
3a0a1d10
Unverified
Commit
3a0a1d10
authored
Apr 14, 2019
by
Sergei Morozov
Committed by
GitHub
Apr 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3356 from Majkl578/builtin-types
Extract constants for built-in types from Type to Types
parents
11b67bbd
4d40444b
Changes
52
Show whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
260 additions
and
126 deletions
+260
-126
UPGRADE.md
UPGRADE.md
+13
-0
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+2
-1
MariaDb1027Platform.php
lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php
+2
-2
MySQL57Platform.php
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
+2
-2
PostgreSQL92Platform.php
lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
+2
-2
PostgreSQL94Platform.php
lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
+2
-2
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+2
-1
SQLAzureFederationsSynchronizer.php
...BAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php
+5
-4
ArrayType.php
lib/Doctrine/DBAL/Types/ArrayType.php
+1
-1
BigIntType.php
lib/Doctrine/DBAL/Types/BigIntType.php
+1
-1
BinaryType.php
lib/Doctrine/DBAL/Types/BinaryType.php
+2
-2
BlobType.php
lib/Doctrine/DBAL/Types/BlobType.php
+2
-2
BooleanType.php
lib/Doctrine/DBAL/Types/BooleanType.php
+1
-1
DateImmutableType.php
lib/Doctrine/DBAL/Types/DateImmutableType.php
+1
-1
DateIntervalType.php
lib/Doctrine/DBAL/Types/DateIntervalType.php
+1
-1
DateTimeImmutableType.php
lib/Doctrine/DBAL/Types/DateTimeImmutableType.php
+1
-1
DateTimeType.php
lib/Doctrine/DBAL/Types/DateTimeType.php
+1
-1
DateTimeTzImmutableType.php
lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php
+1
-1
DateTimeTzType.php
lib/Doctrine/DBAL/Types/DateTimeTzType.php
+1
-1
DateType.php
lib/Doctrine/DBAL/Types/DateType.php
+1
-1
DecimalType.php
lib/Doctrine/DBAL/Types/DecimalType.php
+1
-1
FloatType.php
lib/Doctrine/DBAL/Types/FloatType.php
+1
-1
GuidType.php
lib/Doctrine/DBAL/Types/GuidType.php
+1
-1
IntegerType.php
lib/Doctrine/DBAL/Types/IntegerType.php
+1
-1
JsonArrayType.php
lib/Doctrine/DBAL/Types/JsonArrayType.php
+1
-1
JsonType.php
lib/Doctrine/DBAL/Types/JsonType.php
+1
-1
ObjectType.php
lib/Doctrine/DBAL/Types/ObjectType.php
+1
-1
SimpleArrayType.php
lib/Doctrine/DBAL/Types/SimpleArrayType.php
+1
-1
SmallIntType.php
lib/Doctrine/DBAL/Types/SmallIntType.php
+1
-1
StringType.php
lib/Doctrine/DBAL/Types/StringType.php
+1
-1
TextType.php
lib/Doctrine/DBAL/Types/TextType.php
+1
-1
TimeImmutableType.php
lib/Doctrine/DBAL/Types/TimeImmutableType.php
+1
-1
TimeType.php
lib/Doctrine/DBAL/Types/TimeType.php
+1
-1
Type.php
lib/Doctrine/DBAL/Types/Type.php
+99
-50
Types.php
lib/Doctrine/DBAL/Types/Types.php
+43
-0
VarDateTimeImmutableType.php
lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php
+1
-1
ConnectionTest.php
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+2
-2
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+26
-9
MySqlSchemaManagerTest.php
...e/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
+2
-1
OracleSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
+2
-2
PostgreSqlSchemaManagerTest.php
...ts/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
+3
-2
SqliteSchemaManagerTest.php
.../Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
+3
-2
DB2PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
+2
-1
MariaDb1027PlatformTest.php
...Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
+2
-2
MySQL57PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
+2
-2
PostgreSQL92PlatformTest.php
...octrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
+2
-2
PostgreSQL94PlatformTest.php
...octrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
+2
-2
ColumnDiffTest.php
tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
+3
-2
ColumnTest.php
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
+3
-2
BinaryTest.php
tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
+2
-1
JsonArrayTest.php
tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php
+2
-1
JsonTest.php
tests/Doctrine/Tests/DBAL/Types/JsonTest.php
+2
-1
No files found.
UPGRADE.md
View file @
3a0a1d10
# Upgrade to 2.10
## Deprecated `Type::*` constants
The constants for built-in types have been moved from
`Doctrine\DBAL\Types\Type`
to a separate class
`Doctrine\DBAL\Types\Types`
.
Some of the constants were renamed in the process:
*
`TARRAY`
->
`ARRAY`
*
`DATE`
->
`DATE_MUTABLE`
*
`DATETIME`
->
`DATETIME_MUTABLE`
*
`DATETIMETZ`
->
`DATETIMETZ_MUTABLE`
*
`TIME`
->
`TIME_MUTABLE`
# Upgrade to 2.9
## Deprecated `Statement::fetchColumn()` with an invalid index
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
3a0a1d10
...
...
@@ -8,6 +8,7 @@ use Doctrine\DBAL\Schema\Identifier;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
function
array_merge
;
use
function
count
;
use
function
current
;
...
...
@@ -96,7 +97,7 @@ class DB2Platform extends AbstractPlatform
*/
public
function
isCommentedDoctrineType
(
Type
$doctrineType
)
{
if
(
$doctrineType
->
getName
()
===
Type
::
BOOLEAN
)
{
if
(
$doctrineType
->
getName
()
===
Type
s
::
BOOLEAN
)
{
// We require a commented boolean type in order to distinguish between boolean and smallint
// as both (have to) map to the same native type.
return
true
;
...
...
lib/Doctrine/DBAL/Platforms/MariaDb1027Platform.php
View file @
3a0a1d10
...
...
@@ -2,7 +2,7 @@
namespace
Doctrine\DBAL\Platforms
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.2 (10.2.7 GA) database platform.
...
...
@@ -36,6 +36,6 @@ final class MariaDb1027Platform extends MySqlPlatform
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
::
JSON
;
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
s
::
JSON
;
}
}
lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
View file @
3a0a1d10
...
...
@@ -4,7 +4,7 @@ namespace Doctrine\DBAL\Platforms;
use
Doctrine\DBAL\Schema\Index
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
/**
* Provides the behavior, features and SQL dialect of the MySQL 5.7 (5.7.9 GA) database platform.
...
...
@@ -66,6 +66,6 @@ class MySQL57Platform extends MySqlPlatform
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
::
JSON
;
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
s
::
JSON
;
}
}
lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
View file @
3a0a1d10
...
...
@@ -2,7 +2,7 @@
namespace
Doctrine\DBAL\Platforms
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
use
function
sprintf
;
/**
...
...
@@ -53,7 +53,7 @@ class PostgreSQL92Platform extends PostgreSQL91Platform
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
::
JSON
;
$this
->
doctrineTypeMapping
[
'json'
]
=
Type
s
::
JSON
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
View file @
3a0a1d10
...
...
@@ -2,7 +2,7 @@
namespace
Doctrine\DBAL\Platforms
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
...
...
@@ -36,6 +36,6 @@ class PostgreSQL94Platform extends PostgreSQL92Platform
{
parent
::
initializeDoctrineTypeMappings
();
$this
->
doctrineTypeMapping
[
'jsonb'
]
=
Type
::
JSON
;
$this
->
doctrineTypeMapping
[
'jsonb'
]
=
Type
s
::
JSON
;
}
}
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
3a0a1d10
...
...
@@ -6,6 +6,7 @@ use Doctrine\DBAL\Exception\DriverException;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\Platforms\PostgreSqlPlatform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
const
CASE_LOWER
;
use
function
array_change_key_case
;
use
function
array_filter
;
...
...
@@ -456,7 +457,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$column
->
setPlatformOption
(
'collation'
,
$tableColumn
[
'collation'
]);
}
if
(
in_array
(
$column
->
getType
()
->
getName
(),
[
Type
::
JSON_ARRAY
,
Type
::
JSON
],
true
))
{
if
(
in_array
(
$column
->
getType
()
->
getName
(),
[
Type
s
::
JSON_ARRAY
,
Types
::
JSON
],
true
))
{
$column
->
setPlatformOption
(
'jsonb'
,
$jsonb
);
}
...
...
lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureFederationsSynchronizer.php
View file @
3a0a1d10
...
...
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\Synchronizer\AbstractSchemaSynchronizer;
use
Doctrine\DBAL\Schema\Synchronizer\SchemaSynchronizer
;
use
Doctrine\DBAL\Schema\Synchronizer\SingleDatabaseSynchronizer
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
RuntimeException
;
use
function
array_merge
;
...
...
@@ -240,12 +241,12 @@ class SQLAzureFederationsSynchronizer extends AbstractSchemaSynchronizer
$federationType
=
Type
::
getType
(
$this
->
shardManager
->
getDistributionType
());
switch
(
$federationType
->
getName
())
{
case
Type
::
GUID
:
case
Type
s
::
GUID
:
$defaultValue
=
'00000000-0000-0000-0000-000000000000'
;
break
;
case
Type
::
INTEGER
:
case
Type
::
SMALLINT
:
case
Type
::
BIGINT
:
case
Type
s
::
INTEGER
:
case
Type
s
::
SMALLINT
:
case
Type
s
::
BIGINT
:
$defaultValue
=
'0'
;
break
;
default
:
...
...
lib/Doctrine/DBAL/Types/ArrayType.php
View file @
3a0a1d10
...
...
@@ -59,7 +59,7 @@ class ArrayType extends Type
*/
public
function
getName
()
{
return
Type
::
T
ARRAY
;
return
Type
s
::
ARRAY
;
}
/**
...
...
lib/Doctrine/DBAL/Types/BigIntType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class BigIntType extends Type implements PhpIntegerMappingType
*/
public
function
getName
()
{
return
Type
::
BIGINT
;
return
Type
s
::
BIGINT
;
}
/**
...
...
lib/Doctrine/DBAL/Types/BinaryType.php
View file @
3a0a1d10
...
...
@@ -42,7 +42,7 @@ class BinaryType extends Type
}
if
(
!
is_resource
(
$value
))
{
throw
ConversionException
::
conversionFailed
(
$value
,
self
::
BINARY
);
throw
ConversionException
::
conversionFailed
(
$value
,
Types
::
BINARY
);
}
return
$value
;
...
...
@@ -53,7 +53,7 @@ class BinaryType extends Type
*/
public
function
getName
()
{
return
Type
::
BINARY
;
return
Type
s
::
BINARY
;
}
/**
...
...
lib/Doctrine/DBAL/Types/BlobType.php
View file @
3a0a1d10
...
...
@@ -42,7 +42,7 @@ class BlobType extends Type
}
if
(
!
is_resource
(
$value
))
{
throw
ConversionException
::
conversionFailed
(
$value
,
self
::
BLOB
);
throw
ConversionException
::
conversionFailed
(
$value
,
Types
::
BLOB
);
}
return
$value
;
...
...
@@ -53,7 +53,7 @@ class BlobType extends Type
*/
public
function
getName
()
{
return
Type
::
BLOB
;
return
Type
s
::
BLOB
;
}
/**
...
...
lib/Doctrine/DBAL/Types/BooleanType.php
View file @
3a0a1d10
...
...
@@ -39,7 +39,7 @@ class BooleanType extends Type
*/
public
function
getName
()
{
return
Type
::
BOOLEAN
;
return
Type
s
::
BOOLEAN
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateImmutableType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class DateImmutableType extends DateType
*/
public
function
getName
()
{
return
Type
::
DATE_IMMUTABLE
;
return
Type
s
::
DATE_IMMUTABLE
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateIntervalType.php
View file @
3a0a1d10
...
...
@@ -19,7 +19,7 @@ class DateIntervalType extends Type
*/
public
function
getName
()
{
return
Type
::
DATEINTERVAL
;
return
Type
s
::
DATEINTERVAL
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateTimeImmutableType.php
View file @
3a0a1d10
...
...
@@ -16,7 +16,7 @@ class DateTimeImmutableType extends DateTimeType
*/
public
function
getName
()
{
return
Type
::
DATETIME_IMMUTABLE
;
return
Type
s
::
DATETIME_IMMUTABLE
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateTimeType.php
View file @
3a0a1d10
...
...
@@ -17,7 +17,7 @@ class DateTimeType extends Type implements PhpDateTimeMappingType
*/
public
function
getName
()
{
return
Type
::
DATETIM
E
;
return
Type
s
::
DATETIME_MUTABL
E
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateTimeTzImmutableType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class DateTimeTzImmutableType extends DateTimeTzType
*/
public
function
getName
()
{
return
Type
::
DATETIMETZ_IMMUTABLE
;
return
Type
s
::
DATETIMETZ_IMMUTABLE
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateTimeTzType.php
View file @
3a0a1d10
...
...
@@ -29,7 +29,7 @@ class DateTimeTzType extends Type implements PhpDateTimeMappingType
*/
public
function
getName
()
{
return
Type
::
DATETIMETZ
;
return
Type
s
::
DATETIMETZ_MUTABLE
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DateType.php
View file @
3a0a1d10
...
...
@@ -16,7 +16,7 @@ class DateType extends Type
*/
public
function
getName
()
{
return
Type
::
DAT
E
;
return
Type
s
::
DATE_MUTABL
E
;
}
/**
...
...
lib/Doctrine/DBAL/Types/DecimalType.php
View file @
3a0a1d10
...
...
@@ -14,7 +14,7 @@ class DecimalType extends Type
*/
public
function
getName
()
{
return
Type
::
DECIMAL
;
return
Type
s
::
DECIMAL
;
}
/**
...
...
lib/Doctrine/DBAL/Types/FloatType.php
View file @
3a0a1d10
...
...
@@ -11,7 +11,7 @@ class FloatType extends Type
*/
public
function
getName
()
{
return
Type
::
FLOAT
;
return
Type
s
::
FLOAT
;
}
/**
...
...
lib/Doctrine/DBAL/Types/GuidType.php
View file @
3a0a1d10
...
...
@@ -22,7 +22,7 @@ class GuidType extends StringType
*/
public
function
getName
()
{
return
Type
::
GUID
;
return
Type
s
::
GUID
;
}
/**
...
...
lib/Doctrine/DBAL/Types/IntegerType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class IntegerType extends Type implements PhpIntegerMappingType
*/
public
function
getName
()
{
return
Type
::
INTEGER
;
return
Type
s
::
INTEGER
;
}
/**
...
...
lib/Doctrine/DBAL/Types/JsonArrayType.php
View file @
3a0a1d10
...
...
@@ -33,7 +33,7 @@ class JsonArrayType extends JsonType
*/
public
function
getName
()
{
return
Type
::
JSON_ARRAY
;
return
Type
s
::
JSON_ARRAY
;
}
/**
...
...
lib/Doctrine/DBAL/Types/JsonType.php
View file @
3a0a1d10
...
...
@@ -69,7 +69,7 @@ class JsonType extends Type
*/
public
function
getName
()
{
return
Type
::
JSON
;
return
Type
s
::
JSON
;
}
/**
...
...
lib/Doctrine/DBAL/Types/ObjectType.php
View file @
3a0a1d10
...
...
@@ -58,7 +58,7 @@ class ObjectType extends Type
*/
public
function
getName
()
{
return
Type
::
OBJECT
;
return
Type
s
::
OBJECT
;
}
/**
...
...
lib/Doctrine/DBAL/Types/SimpleArrayType.php
View file @
3a0a1d10
...
...
@@ -54,7 +54,7 @@ class SimpleArrayType extends Type
*/
public
function
getName
()
{
return
Type
::
SIMPLE_ARRAY
;
return
Type
s
::
SIMPLE_ARRAY
;
}
/**
...
...
lib/Doctrine/DBAL/Types/SmallIntType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class SmallIntType extends Type implements PhpIntegerMappingType
*/
public
function
getName
()
{
return
Type
::
SMALLINT
;
return
Type
s
::
SMALLINT
;
}
/**
...
...
lib/Doctrine/DBAL/Types/StringType.php
View file @
3a0a1d10
...
...
@@ -30,6 +30,6 @@ class StringType extends Type
*/
public
function
getName
()
{
return
Type
::
STRING
;
return
Type
s
::
STRING
;
}
}
lib/Doctrine/DBAL/Types/TextType.php
View file @
3a0a1d10
...
...
@@ -32,6 +32,6 @@ class TextType extends Type
*/
public
function
getName
()
{
return
Type
::
TEXT
;
return
Type
s
::
TEXT
;
}
}
lib/Doctrine/DBAL/Types/TimeImmutableType.php
View file @
3a0a1d10
...
...
@@ -15,7 +15,7 @@ class TimeImmutableType extends TimeType
*/
public
function
getName
()
{
return
Type
::
TIME_IMMUTABLE
;
return
Type
s
::
TIME_IMMUTABLE
;
}
/**
...
...
lib/Doctrine/DBAL/Types/TimeType.php
View file @
3a0a1d10
...
...
@@ -16,7 +16,7 @@ class TimeType extends Type
*/
public
function
getName
()
{
return
Type
::
TIM
E
;
return
Type
s
::
TIME_MUTABL
E
;
}
/**
...
...
lib/Doctrine/DBAL/Types/Type.php
View file @
3a0a1d10
...
...
@@ -18,61 +18,110 @@ use function substr;
*/
abstract
class
Type
{
public
const
BIGINT
=
'bigint'
;
public
const
BINARY
=
'binary'
;
public
const
BLOB
=
'blob'
;
public
const
BOOLEAN
=
'boolean'
;
public
const
DATE
=
'date'
;
public
const
DATE_IMMUTABLE
=
'date_immutable'
;
public
const
DATEINTERVAL
=
'dateinterval'
;
public
const
DATETIME
=
'datetime'
;
public
const
DATETIME_IMMUTABLE
=
'datetime_immutable'
;
public
const
DATETIMETZ
=
'datetimetz'
;
public
const
DATETIMETZ_IMMUTABLE
=
'datetimetz_immutable'
;
public
const
DECIMAL
=
'decimal'
;
public
const
FLOAT
=
'float'
;
public
const
GUID
=
'guid'
;
public
const
INTEGER
=
'integer'
;
public
const
JSON
=
'json'
;
public
const
JSON_ARRAY
=
'json_array'
;
public
const
OBJECT
=
'object'
;
public
const
SIMPLE_ARRAY
=
'simple_array'
;
public
const
SMALLINT
=
'smallint'
;
public
const
STRING
=
'string'
;
public
const
TARRAY
=
'array'
;
public
const
TEXT
=
'text'
;
public
const
TIME
=
'time'
;
public
const
TIME_IMMUTABLE
=
'time_immutable'
;
/** @deprecated Use {@see DefaultTypes::BIGINT} instead. */
public
const
BIGINT
=
Types
::
BIGINT
;
/** @deprecated Use {@see DefaultTypes::BINARY} instead. */
public
const
BINARY
=
Types
::
BINARY
;
/** @deprecated Use {@see DefaultTypes::BLOB} instead. */
public
const
BLOB
=
Types
::
BLOB
;
/** @deprecated Use {@see DefaultTypes::BOOLEAN} instead. */
public
const
BOOLEAN
=
Types
::
BOOLEAN
;
/** @deprecated Use {@see DefaultTypes::DATE_MUTABLE} instead. */
public
const
DATE
=
Types
::
DATE_MUTABLE
;
/** @deprecated Use {@see DefaultTypes::DATE_IMMUTABLE} instead. */
public
const
DATE_IMMUTABLE
=
Types
::
DATE_IMMUTABLE
;
/** @deprecated Use {@see DefaultTypes::DATEINTERVAL} instead. */
public
const
DATEINTERVAL
=
Types
::
DATEINTERVAL
;
/** @deprecated Use {@see DefaultTypes::DATETIME_MUTABLE} instead. */
public
const
DATETIME
=
Types
::
DATETIME_MUTABLE
;
/** @deprecated Use {@see DefaultTypes::DATETIME_IMMUTABLE} instead. */
public
const
DATETIME_IMMUTABLE
=
Types
::
DATETIME_IMMUTABLE
;
/** @deprecated Use {@see DefaultTypes::DATETIMETZ_MUTABLE} instead. */
public
const
DATETIMETZ
=
Types
::
DATETIMETZ_MUTABLE
;
/** @deprecated Use {@see DefaultTypes::DATETIMETZ_IMMUTABLE} instead. */
public
const
DATETIMETZ_IMMUTABLE
=
Types
::
DATETIMETZ_IMMUTABLE
;
/** @deprecated Use {@see DefaultTypes::DECIMAL} instead. */
public
const
DECIMAL
=
Types
::
DECIMAL
;
/** @deprecated Use {@see DefaultTypes::FLOAT} instead. */
public
const
FLOAT
=
Types
::
FLOAT
;
/** @deprecated Use {@see DefaultTypes::GUID} instead. */
public
const
GUID
=
Types
::
GUID
;
/** @deprecated Use {@see DefaultTypes::INTEGER} instead. */
public
const
INTEGER
=
Types
::
INTEGER
;
/** @deprecated Use {@see DefaultTypes::JSON} instead. */
public
const
JSON
=
Types
::
JSON
;
/** @deprecated Use {@see DefaultTypes::JSON_ARRAY} instead. */
public
const
JSON_ARRAY
=
Types
::
JSON_ARRAY
;
/** @deprecated Use {@see DefaultTypes::OBJECT} instead. */
public
const
OBJECT
=
Types
::
OBJECT
;
/** @deprecated Use {@see DefaultTypes::SIMPLE_ARRAY} instead. */
public
const
SIMPLE_ARRAY
=
Types
::
SIMPLE_ARRAY
;
/** @deprecated Use {@see DefaultTypes::SMALLINT} instead. */
public
const
SMALLINT
=
Types
::
SMALLINT
;
/** @deprecated Use {@see DefaultTypes::STRING} instead. */
public
const
STRING
=
Types
::
STRING
;
/** @deprecated Use {@see DefaultTypes::ARRAY} instead. */
public
const
TARRAY
=
Types
::
ARRAY
;
/** @deprecated Use {@see DefaultTypes::TEXT} instead. */
public
const
TEXT
=
Types
::
TEXT
;
/** @deprecated Use {@see DefaultTypes::TIME_MUTABLE} instead. */
public
const
TIME
=
Types
::
TIME_MUTABLE
;
/** @deprecated Use {@see DefaultTypes::TIME_IMMUTABLE} instead. */
public
const
TIME_IMMUTABLE
=
Types
::
TIME_IMMUTABLE
;
/**
* The map of supported doctrine mapping types.
*/
private
const
BUILTIN_TYPES_MAP
=
[
self
::
BIGINT
=>
BigInt
Type
::
class
,
self
::
BINARY
=>
Binary
Type
::
class
,
self
::
BLOB
=>
Blob
Type
::
class
,
self
::
BOOLEAN
=>
Boolean
Type
::
class
,
self
::
DATE
=>
Date
Type
::
class
,
self
::
DATE_IMMUTABLE
=>
DateImmutabl
eType
::
class
,
self
::
DATEINTERVAL
=>
DateInterval
Type
::
class
,
self
::
DATETIME
=>
DateTime
Type
::
class
,
self
::
DATETIME_IMMUTABLE
=>
DateTimeImmutabl
eType
::
class
,
self
::
DATETIMETZ
=>
DateTimeTz
Type
::
class
,
self
::
DATETIMETZ_IMMUTABLE
=>
DateTimeTzImmutable
Type
::
class
,
self
::
DECIMAL
=>
Decimal
Type
::
class
,
self
::
FLOAT
=>
Float
Type
::
class
,
self
::
GUID
=>
Guid
Type
::
class
,
self
::
INTEGER
=>
Integer
Type
::
class
,
self
::
JSON
=>
Json
Type
::
class
,
self
::
JSON_ARRAY
=>
JsonArray
Type
::
class
,
self
::
OBJECT
=>
Object
Type
::
class
,
self
::
SIMPLE_ARRAY
=>
SimpleArray
Type
::
class
,
self
::
SMALLINT
=>
SmallInt
Type
::
class
,
self
::
STRING
=>
String
Type
::
class
,
self
::
TARRAY
=>
Array
Type
::
class
,
self
::
TEXT
=>
TextType
::
class
,
self
::
TIME
=>
TimeType
::
class
,
self
::
TIME_IMMUTABLE
=>
TimeImmutableType
::
class
,
Types
::
ARRAY
=>
Array
Type
::
class
,
Types
::
BIGINT
=>
BigInt
Type
::
class
,
Types
::
BINARY
=>
Binary
Type
::
class
,
Types
::
BLOB
=>
Blob
Type
::
class
,
Types
::
BOOLEAN
=>
Boolean
Type
::
class
,
Types
::
DATE_MUTABLE
=>
Dat
eType
::
class
,
Types
::
DATE_IMMUTABLE
=>
DateImmutable
Type
::
class
,
Types
::
DATEINTERVAL
=>
DateInterval
Type
::
class
,
Types
::
DATETIME_MUTABLE
=>
DateTim
eType
::
class
,
Types
::
DATETIME_IMMUTABLE
=>
DateTimeImmutable
Type
::
class
,
Types
::
DATETIMETZ_MUTABLE
=>
DateTimeTz
Type
::
class
,
Types
::
DATETIMETZ_IMMUTABLE
=>
DateTimeTzImmutable
Type
::
class
,
Types
::
DECIMAL
=>
Decimal
Type
::
class
,
Types
::
FLOAT
=>
Float
Type
::
class
,
Types
::
GUID
=>
Guid
Type
::
class
,
Types
::
INTEGER
=>
Integer
Type
::
class
,
Types
::
JSON
=>
Json
Type
::
class
,
Types
::
JSON_ARRAY
=>
JsonArray
Type
::
class
,
Types
::
OBJECT
=>
Object
Type
::
class
,
Types
::
SIMPLE_ARRAY
=>
SimpleArray
Type
::
class
,
Types
::
SMALLINT
=>
SmallInt
Type
::
class
,
Types
::
STRING
=>
String
Type
::
class
,
Types
::
TEXT
=>
TextType
::
class
,
Types
::
TIME_MUTABLE
=>
TimeType
::
class
,
Types
::
TIME_IMMUTABLE
=>
TimeImmutableType
::
class
,
];
/** @var TypeRegistry|null */
...
...
lib/Doctrine/DBAL/Types/Types.php
0 → 100644
View file @
3a0a1d10
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Types
;
/**
* Default built-in types provided by Doctrine DBAL.
*/
final
class
Types
{
public
const
ARRAY
=
'array'
;
public
const
BIGINT
=
'bigint'
;
public
const
BINARY
=
'binary'
;
public
const
BLOB
=
'blob'
;
public
const
BOOLEAN
=
'boolean'
;
public
const
DATE_MUTABLE
=
'date'
;
public
const
DATE_IMMUTABLE
=
'date_immutable'
;
public
const
DATEINTERVAL
=
'dateinterval'
;
public
const
DATETIME_MUTABLE
=
'datetime'
;
public
const
DATETIME_IMMUTABLE
=
'datetime_immutable'
;
public
const
DATETIMETZ_MUTABLE
=
'datetimetz'
;
public
const
DATETIMETZ_IMMUTABLE
=
'datetimetz_immutable'
;
public
const
DECIMAL
=
'decimal'
;
public
const
FLOAT
=
'float'
;
public
const
GUID
=
'guid'
;
public
const
INTEGER
=
'integer'
;
public
const
JSON
=
'json'
;
public
const
OBJECT
=
'object'
;
public
const
SIMPLE_ARRAY
=
'simple_array'
;
public
const
SMALLINT
=
'smallint'
;
public
const
STRING
=
'string'
;
public
const
TEXT
=
'text'
;
public
const
TIME_MUTABLE
=
'time'
;
public
const
TIME_IMMUTABLE
=
'time_immutable'
;
/** @deprecated json_array type is deprecated, use {@see DefaultTypes::JSON} instead. */
public
const
JSON_ARRAY
=
'json_array'
;
private
function
__construct
()
{
}
}
lib/Doctrine/DBAL/Types/VarDateTimeImmutableType.php
View file @
3a0a1d10
...
...
@@ -16,7 +16,7 @@ class VarDateTimeImmutableType extends VarDateTimeType
*/
public
function
getName
()
{
return
Type
::
DATETIME_IMMUTABLE
;
return
Type
s
::
DATETIME_IMMUTABLE
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
3a0a1d10
...
...
@@ -8,7 +8,7 @@ use Doctrine\DBAL\Driver\Connection as DriverConnection;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\ParameterType
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
Error
;
use
Exception
;
...
...
@@ -252,7 +252,7 @@ class ConnectionTest extends DbalFunctionalTestCase
public
function
testQuote
()
{
self
::
assertEquals
(
$this
->
connection
->
quote
(
'foo'
,
Type
::
STRING
),
$this
->
connection
->
quote
(
'foo'
,
Type
s
::
STRING
),
$this
->
connection
->
quote
(
'foo'
,
ParameterType
::
STRING
)
);
}
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
3a0a1d10
...
...
@@ -16,7 +16,7 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
use
Doctrine\DBAL\Platforms\TrimMode
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Statement
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
PDO
;
use
const
CASE_LOWER
;
...
...
@@ -225,7 +225,11 @@ class DataAccessTest extends DbalFunctionalTestCase
$datetime
=
new
DateTime
(
$datetimeString
);
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$data
=
$this
->
connection
->
fetchAll
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]);
$data
=
$this
->
connection
->
fetchAll
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Types
::
DATETIME_MUTABLE
]
);
self
::
assertCount
(
1
,
$data
);
...
...
@@ -297,7 +301,11 @@ class DataAccessTest extends DbalFunctionalTestCase
$datetime
=
new
DateTime
(
$datetimeString
);
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$row
=
$this
->
connection
->
fetchAssoc
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]);
$row
=
$this
->
connection
->
fetchAssoc
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Types
::
DATETIME_MUTABLE
]
);
self
::
assertNotFalse
(
$row
);
...
...
@@ -338,7 +346,11 @@ class DataAccessTest extends DbalFunctionalTestCase
$datetime
=
new
DateTime
(
$datetimeString
);
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$row
=
$this
->
connection
->
fetchArray
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]);
$row
=
$this
->
connection
->
fetchArray
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Types
::
DATETIME_MUTABLE
]
);
self
::
assertNotFalse
(
$row
);
...
...
@@ -383,7 +395,12 @@ class DataAccessTest extends DbalFunctionalTestCase
$datetime
=
new
DateTime
(
$datetimeString
);
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$column
=
$this
->
connection
->
fetchColumn
(
$sql
,
[
1
,
$datetime
],
1
,
[
ParameterType
::
STRING
,
Type
::
DATETIME
]);
$column
=
$this
->
connection
->
fetchColumn
(
$sql
,
[
1
,
$datetime
],
1
,
[
ParameterType
::
STRING
,
Types
::
DATETIME_MUTABLE
]
);
self
::
assertNotFalse
(
$column
);
...
...
@@ -415,7 +432,7 @@ class DataAccessTest extends DbalFunctionalTestCase
$stmt
=
$this
->
connection
->
executeQuery
(
$sql
,
[
1
=>
new
DateTime
(
'2010-01-01 10:10:10'
)],
[
1
=>
Type
::
DATETIM
E
]
[
1
=>
Type
s
::
DATETIME_MUTABL
E
]
);
self
::
assertEquals
(
1
,
$stmt
->
fetchColumn
());
...
...
@@ -436,14 +453,14 @@ class DataAccessTest extends DbalFunctionalTestCase
],
[
1
=>
ParameterType
::
INTEGER
,
2
=>
ParameterType
::
STRING
,
3
=>
Type
::
DATETIM
E
,
3
=>
Type
s
::
DATETIME_MUTABL
E
,
]);
self
::
assertEquals
(
1
,
$affectedRows
);
self
::
assertEquals
(
1
,
$this
->
connection
->
executeQuery
(
'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?'
,
[
1
=>
$datetime
],
[
1
=>
Type
::
DATETIM
E
]
[
1
=>
Type
s
::
DATETIME_MUTABL
E
]
)
->
fetchColumn
());
}
...
...
@@ -454,7 +471,7 @@ class DataAccessTest extends DbalFunctionalTestCase
{
$sql
=
'SELECT count(*) AS c FROM fetch_table WHERE test_datetime = ?'
;
$stmt
=
$this
->
connection
->
prepare
(
$sql
);
$stmt
->
bindValue
(
1
,
new
DateTime
(
'2010-01-01 10:10:10'
),
Type
::
DATETIM
E
);
$stmt
->
bindValue
(
1
,
new
DateTime
(
'2010-01-01 10:10:10'
),
Type
s
::
DATETIME_MUTABL
E
);
$stmt
->
execute
();
self
::
assertEquals
(
1
,
$stmt
->
fetchColumn
());
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/MySqlSchemaManagerTest.php
View file @
3a0a1d10
...
...
@@ -9,6 +9,7 @@ use Doctrine\DBAL\Schema\Comparator;
use
Doctrine\DBAL\Schema\Schema
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\Types\MySqlPointType
;
use
function
implode
;
use
function
sprintf
;
...
...
@@ -415,7 +416,7 @@ class MySqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$columns
=
$this
->
schemaManager
->
listTableColumns
(
'test_mysql_json'
);
self
::
assertSame
(
Type
::
JSON
,
$columns
[
'col_json'
]
->
getType
()
->
getName
());
self
::
assertSame
(
Type
s
::
JSON
,
$columns
[
'col_json'
]
->
getType
()
->
getName
());
}
public
function
testColumnDefaultCurrentTimestamp
()
:
void
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php
View file @
3a0a1d10
...
...
@@ -5,7 +5,7 @@ namespace Doctrine\Tests\DBAL\Functional\Schema;
use
Doctrine\DBAL\Schema
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\BinaryType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
use
Doctrine\Tests\TestUtil
;
use
function
array_map
;
...
...
@@ -232,7 +232,7 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this
->
schemaManager
->
dropAndCreateTable
(
$table
);
$otherTable
=
new
Table
(
$table
->
getName
());
$otherTable
->
addColumn
(
'id'
,
Type
::
STRING
);
$otherTable
->
addColumn
(
'id'
,
Type
s
::
STRING
);
TestUtil
::
getTempConnection
()
->
getSchemaManager
()
->
dropAndCreateTable
(
$otherTable
);
$columns
=
$this
->
schemaManager
->
listTableColumns
(
$table
->
getName
(),
$this
->
connection
->
getUsername
());
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php
View file @
3a0a1d10
...
...
@@ -12,6 +12,7 @@ use Doctrine\DBAL\Schema\TableDiff;
use
Doctrine\DBAL\Types\BlobType
;
use
Doctrine\DBAL\Types\DecimalType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
function
array_map
;
use
function
array_pop
;
use
function
count
;
...
...
@@ -410,8 +411,8 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public
function
jsonbColumnTypeProvider
()
:
array
{
return
[
[
Type
::
JSON
],
[
Type
::
JSON_ARRAY
],
[
Type
s
::
JSON
],
[
Type
s
::
JSON_ARRAY
],
];
}
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SqliteSchemaManagerTest.php
View file @
3a0a1d10
...
...
@@ -8,6 +8,7 @@ use Doctrine\DBAL\Schema;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\BlobType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
SQLite3
;
use
function
array_map
;
use
function
dirname
;
...
...
@@ -206,8 +207,8 @@ SQL;
self
::
assertArrayHasKey
(
'foo'
,
$columns
);
self
::
assertArrayHasKey
(
'bar'
,
$columns
);
self
::
assertSame
(
Type
::
getType
(
Type
::
STRING
),
$columns
[
'foo'
]
->
getType
());
self
::
assertSame
(
Type
::
getType
(
Type
::
TEXT
),
$columns
[
'bar'
]
->
getType
());
self
::
assertSame
(
Type
::
getType
(
Type
s
::
STRING
),
$columns
[
'foo'
]
->
getType
());
self
::
assertSame
(
Type
::
getType
(
Type
s
::
TEXT
),
$columns
[
'bar'
]
->
getType
());
self
::
assertSame
(
64
,
$columns
[
'foo'
]
->
getLength
());
self
::
assertSame
(
100
,
$columns
[
'bar'
]
->
getLength
());
...
...
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
View file @
3a0a1d10
...
...
@@ -10,6 +10,7 @@ use Doctrine\DBAL\Schema\Index;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\TableDiff
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
class
DB2PlatformTest
extends
AbstractPlatformTestCase
{
...
...
@@ -279,7 +280,7 @@ class DB2PlatformTest extends AbstractPlatformTestCase
{
$data
=
parent
::
getIsCommentedDoctrineType
();
$data
[
Type
::
BOOLEAN
]
=
[
Type
::
getType
(
Type
::
BOOLEAN
),
true
];
$data
[
Type
s
::
BOOLEAN
]
=
[
Type
::
getType
(
Types
::
BOOLEAN
),
true
];
return
$data
;
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/MariaDb1027PlatformTest.php
View file @
3a0a1d10
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\MariaDb1027Platform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
class
MariaDb1027PlatformTest
extends
AbstractMySQLPlatformTestCase
{
...
...
@@ -33,7 +33,7 @@ class MariaDb1027PlatformTest extends AbstractMySQLPlatformTestCase
public
function
testInitializesJsonTypeMapping
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertSame
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
self
::
assertSame
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/MySQL57PlatformTest.php
View file @
3a0a1d10
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\MySQL57Platform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
class
MySQL57PlatformTest
extends
AbstractMySQLPlatformTestCase
{
...
...
@@ -28,7 +28,7 @@ class MySQL57PlatformTest extends AbstractMySQLPlatformTestCase
public
function
testInitializesJsonTypeMapping
()
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertSame
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
self
::
assertSame
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL92PlatformTest.php
View file @
3a0a1d10
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\PostgreSQL92Platform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
class
PostgreSQL92PlatformTest
extends
AbstractPostgreSqlPlatformTestCase
{
...
...
@@ -55,7 +55,7 @@ class PostgreSQL92PlatformTest extends AbstractPostgreSqlPlatformTestCase
public
function
testInitializesJsonTypeMapping
()
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertEquals
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
self
::
assertEquals
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
}
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/PostgreSQL94PlatformTest.php
View file @
3a0a1d10
...
...
@@ -3,7 +3,7 @@
namespace
Doctrine\Tests\DBAL\Platforms
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
class
PostgreSQL94PlatformTest
extends
PostgreSQL92PlatformTest
{
...
...
@@ -26,6 +26,6 @@ class PostgreSQL94PlatformTest extends PostgreSQL92PlatformTest
{
parent
::
testInitializesJsonTypeMapping
();
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'jsonb'
));
self
::
assertEquals
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'jsonb'
));
self
::
assertEquals
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'jsonb'
));
}
}
tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
View file @
3a0a1d10
...
...
@@ -5,6 +5,7 @@ namespace Doctrine\Tests\DBAL\Schema;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\ColumnDiff
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
PHPUnit\Framework\TestCase
;
class
ColumnDiffTest
extends
TestCase
...
...
@@ -14,8 +15,8 @@ class ColumnDiffTest extends TestCase
*/
public
function
testPreservesOldColumnNameQuotation
()
{
$fromColumn
=
new
Column
(
'"foo"'
,
Type
::
getType
(
Type
::
INTEGER
));
$toColumn
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
::
INTEGER
));
$fromColumn
=
new
Column
(
'"foo"'
,
Type
::
getType
(
Type
s
::
INTEGER
));
$toColumn
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
s
::
INTEGER
));
$columnDiff
=
new
ColumnDiff
(
'"foo"'
,
$toColumn
,
[]);
self
::
assertTrue
(
$columnDiff
->
getOldColumnName
()
->
isQuoted
());
...
...
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
View file @
3a0a1d10
...
...
@@ -7,6 +7,7 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
use
Doctrine\DBAL\Platforms\SQLServerPlatform
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
PHPUnit\Framework\TestCase
;
class
ColumnTest
extends
TestCase
...
...
@@ -74,10 +75,10 @@ class ColumnTest extends TestCase
*/
public
function
testOptionsShouldNotBeIgnored
()
:
void
{
$col1
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
::
INTEGER
),
[
'unknown_option'
=>
'bar'
,
'notnull'
=>
true
]);
$col1
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
s
::
INTEGER
),
[
'unknown_option'
=>
'bar'
,
'notnull'
=>
true
]);
self
::
assertTrue
(
$col1
->
getNotnull
());
$col2
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
::
INTEGER
),
[
'unknown_option'
=>
'bar'
,
'notnull'
=>
false
]);
$col2
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
s
::
INTEGER
),
[
'unknown_option'
=>
'bar'
,
'notnull'
=>
false
]);
self
::
assertFalse
(
$col2
->
getNotnull
());
}
...
...
tests/Doctrine/Tests/DBAL/Types/BinaryTest.php
View file @
3a0a1d10
...
...
@@ -7,6 +7,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use
Doctrine\DBAL\Types\BinaryType
;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
function
base64_encode
;
...
...
@@ -37,7 +38,7 @@ class BinaryTest extends DbalTestCase
public
function
testReturnsName
()
{
self
::
assertSame
(
Type
::
BINARY
,
$this
->
type
->
getName
());
self
::
assertSame
(
Type
s
::
BINARY
,
$this
->
type
->
getName
());
}
public
function
testReturnsSQLDeclaration
()
...
...
tests/Doctrine/Tests/DBAL/Types/JsonArrayTest.php
View file @
3a0a1d10
...
...
@@ -6,6 +6,7 @@ use Doctrine\DBAL\ParameterType;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Types\JsonArrayType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
function
base64_encode
;
...
...
@@ -36,7 +37,7 @@ class JsonArrayTest extends DbalTestCase
public
function
testReturnsName
()
{
self
::
assertSame
(
Type
::
JSON_ARRAY
,
$this
->
type
->
getName
());
self
::
assertSame
(
Type
s
::
JSON_ARRAY
,
$this
->
type
->
getName
());
}
public
function
testReturnsSQLDeclaration
()
...
...
tests/Doctrine/Tests/DBAL/Types/JsonTest.php
View file @
3a0a1d10
...
...
@@ -7,6 +7,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use
Doctrine\DBAL\Types\ConversionException
;
use
Doctrine\DBAL\Types\JsonType
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
Doctrine\Tests\DbalTestCase
;
use
PHPUnit\Framework\MockObject\MockObject
;
use
function
base64_encode
;
...
...
@@ -37,7 +38,7 @@ class JsonTest extends DbalTestCase
public
function
testReturnsName
()
{
self
::
assertSame
(
Type
::
JSON
,
$this
->
type
->
getName
());
self
::
assertSame
(
Type
s
::
JSON
,
$this
->
type
->
getName
());
}
public
function
testReturnsSQLDeclaration
()
...
...
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