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
138eb852
Unverified
Commit
138eb852
authored
May 30, 2019
by
Jonathan H. Wage
Committed by
Sergei Morozov
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated stuff for 3.0
parent
c58dd2fb
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
54 additions
and
155 deletions
+54
-155
Configuration.php
src/Configuration.php
+0
-40
SQLSrvStatement.php
src/Driver/SQLSrv/SQLSrvStatement.php
+1
-3
AbstractPlatform.php
src/Platforms/AbstractPlatform.php
+13
-12
PostgreSQL94Platform.php
src/Platforms/PostgreSQL94Platform.php
+2
-2
SQLParserUtils.php
src/SQLParserUtils.php
+4
-7
Column.php
src/Schema/Column.php
+3
-12
UnknownColumnOption.php
src/Schema/Exception/UnknownColumnOption.php
+22
-0
Type.php
src/Types/Type.php
+0
-72
Types.php
src/Types/Types.php
+0
-3
PostgreSQL94PlatformTest.php
tests/Platforms/PostgreSQL94PlatformTest.php
+3
-3
ColumnTest.php
tests/Schema/ColumnTest.php
+6
-1
No files found.
src/Configuration.php
View file @
138eb852
...
...
@@ -4,9 +4,6 @@ namespace Doctrine\DBAL;
use
Doctrine\Common\Cache\Cache
;
use
Doctrine\DBAL\Logging\SQLLogger
;
use
Doctrine\DBAL\Schema\AbstractAsset
;
use
function
preg_match
;
/**
* Configuration container for the Doctrine DBAL.
...
...
@@ -64,43 +61,6 @@ class Configuration
$this
->
_attributes
[
'resultCacheImpl'
]
=
$cacheImpl
;
}
/**
* Sets the filter schema assets expression.
*
* Only include tables/sequences matching the filter expression regexp in
* schema instances generated for the active connection when calling
* {AbstractSchemaManager#createSchema()}.
*
* @deprecated Use Configuration::setSchemaAssetsFilter() instead
*
* @param string|null $filterExpression
*
* @return void
*/
public
function
setFilterSchemaAssetsExpression
(
$filterExpression
)
{
$this
->
_attributes
[
'filterSchemaAssetsExpression'
]
=
$filterExpression
;
if
(
$filterExpression
!==
null
)
{
$this
->
_attributes
[
'filterSchemaAssetsExpressionCallable'
]
=
$this
->
buildSchemaAssetsFilterFromExpression
(
$filterExpression
);
}
else
{
$this
->
_attributes
[
'filterSchemaAssetsExpressionCallable'
]
=
null
;
}
}
/**
* @param string $filterExpression
*/
private
function
buildSchemaAssetsFilterFromExpression
(
$filterExpression
)
:
callable
{
return
static
function
(
$assetName
)
use
(
$filterExpression
)
{
if
(
$assetName
instanceof
AbstractAsset
)
{
$assetName
=
$assetName
->
getName
();
}
return
preg_match
(
$filterExpression
,
$assetName
);
};
}
/**
* Sets the callable to use to filter schema assets.
*/
...
...
src/Driver/SQLSrv/SQLSrvStatement.php
View file @
138eb852
...
...
@@ -70,10 +70,8 @@ final class SQLSrvStatement implements Statement
/**
* Append to any INSERT query to retrieve the last insert id.
*
* @deprecated This constant has been deprecated and will be made private in 3.0
*/
p
ublic
const
LAST_INSERT_ID_SQL
=
';SELECT SCOPE_IDENTITY() AS LastInsertId;'
;
p
rivate
const
LAST_INSERT_ID_SQL
=
';SELECT SCOPE_IDENTITY() AS LastInsertId;'
;
/**
* @param resource $conn
...
...
src/Platforms/AbstractPlatform.php
View file @
138eb852
...
...
@@ -2322,7 +2322,7 @@ abstract class AbstractPlatform
}
return
'CONSTRAINT '
.
$name
->
getQuotedName
(
$this
)
.
' UNIQUE ('
.
$this
->
get
IndexFieldDeclarationListSQL
(
$index
)
.
$this
->
get
ColumnsFieldDeclarationListSQL
(
$columns
)
.
')'
.
$this
->
getPartialIndexSQL
(
$index
);
}
...
...
@@ -2368,22 +2368,23 @@ abstract class AbstractPlatform
/**
* Obtains DBMS specific SQL code portion needed to set an index
* declaration to be used in statements like CREATE TABLE.
*
* @param mixed[]|Index $columnsOrIndex array declaration is deprecated, prefer passing Index to this method
*/
public
function
getIndexFieldDeclarationListSQL
(
$columnsOrI
ndex
)
:
string
public
function
getIndexFieldDeclarationListSQL
(
Index
$i
ndex
)
:
string
{
if
(
$columnsOrIndex
instanceof
Index
)
{
return
implode
(
', '
,
$columnsOrIndex
->
getQuotedColumns
(
$this
));
}
if
(
!
is_array
(
$columnsOrIndex
))
{
throw
new
InvalidArgumentException
(
'Fields argument should be an Index or array.'
);
return
implode
(
', '
,
$index
->
getQuotedColumns
(
$this
));
}
/**
* Obtains DBMS specific SQL code portion needed to set an index
* declaration to be used in statements like CREATE TABLE.
*
* @param mixed[] $columns
*/
public
function
getColumnsFieldDeclarationListSQL
(
array
$columns
)
:
string
{
$ret
=
[];
foreach
(
$columns
OrIndex
as
$column
=>
$definition
)
{
foreach
(
$columns
as
$column
=>
$definition
)
{
if
(
is_array
(
$definition
))
{
$ret
[]
=
$column
;
}
else
{
...
...
src/Platforms/PostgreSQL94Platform.php
View file @
138eb852
...
...
@@ -1158,8 +1158,8 @@ SQL
'int8'
=>
'bigint'
,
'integer'
=>
'integer'
,
'interval'
=>
'string'
,
'json'
=>
Type
::
JSON
,
'jsonb'
=>
Type
::
JSON
,
'json'
=>
'json'
,
'jsonb'
=>
'json'
,
'money'
=>
'decimal'
,
'numeric'
=>
'decimal'
,
'serial'
=>
'integer'
,
...
...
src/SQLParserUtils.php
View file @
138eb852
...
...
@@ -32,15 +32,12 @@ class SQLParserUtils
/**#@+
* Quote characters within string literals can be preceded by a backslash.
*
* @deprecated Will be removed as internal implementation details.
*/
public
const
ESCAPED_SINGLE_QUOTED_TEXT
=
"(?:'(?:
\\\\
)+'|'(?:[^'
\\\\
]|
\\\\
'?|'')*')"
;
public
const
ESCAPED_DOUBLE_QUOTED_TEXT
=
'(?:"(?:\\\\)+"|"(?:[^"\\\\]|\\\\"?)*")'
;
public
const
ESCAPED_BACKTICK_QUOTED_TEXT
=
'(?:`(?:\\\\)+`|`(?:[^`\\\\]|\\\\`?)*`)'
;
/**#@-*/
private
const
ESCAPED_SINGLE_QUOTED_TEXT
=
"(?:'(?:
\\\\
)+'|'(?:[^'
\\\\
]|
\\\\
'?|'')*')"
;
private
const
ESCAPED_DOUBLE_QUOTED_TEXT
=
'(?:"(?:\\\\)+"|"(?:[^"\\\\]|\\\\"?)*")'
;
private
const
ESCAPED_BACKTICK_QUOTED_TEXT
=
'(?:`(?:\\\\)+`|`(?:[^`\\\\]|\\\\`?)*`)'
;
private
const
ESCAPED_BRACKET_QUOTED_TEXT
=
'(?<!\b(?i:ARRAY))\[(?:[^\]])*\]'
;
/**#@-*/
/**
* Returns a zero-indexed list of placeholder position.
...
...
src/Schema/Column.php
View file @
138eb852
...
...
@@ -2,15 +2,12 @@
namespace
Doctrine\DBAL\Schema
;
use
Doctrine\DBAL\Schema\Exception\UnknownColumnOption
;
use
Doctrine\DBAL\Types\Type
;
use
function
array_merge
;
use
function
is_numeric
;
use
function
method_exists
;
use
function
sprintf
;
use
function
trigger_error
;
use
const
E_USER_DEPRECATED
;
/**
* Object representation of a database column.
...
...
@@ -78,15 +75,9 @@ class Column extends AbstractAsset
{
foreach
(
$options
as
$name
=>
$value
)
{
$method
=
'set'
.
$name
;
if
(
!
method_exists
(
$this
,
$method
))
{
// next major: throw an exception
@
trigger_error
(
sprintf
(
'The "%s" column option is not supported,'
.
' setting it is deprecated and will cause an error in Doctrine DBAL 3.0'
,
$name
),
E_USER_DEPRECATED
);
continue
;
throw
UnknownColumnOption
::
new
(
$name
);
}
$this
->
$method
(
$value
);
...
...
src/Schema/Exception/UnknownColumnOption.php
0 → 100644
View file @
138eb852
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Schema\Exception
;
use
Doctrine\DBAL\Schema\SchemaException
;
use
function
sprintf
;
/**
* @psalm-immutable
*/
final
class
UnknownColumnOption
extends
SchemaException
{
public
static
function
new
(
string
$name
)
:
self
{
return
new
self
(
sprintf
(
'The "%s" column option is not supported.'
,
$name
)
);
}
}
src/Types/Type.php
View file @
138eb852
...
...
@@ -19,78 +19,6 @@ use function substr;
*/
abstract
class
Type
{
/** @deprecated Use {@see Types::BIGINT} instead. */
public
const
BIGINT
=
Types
::
BIGINT
;
/** @deprecated Use {@see Types::BINARY} instead. */
public
const
BINARY
=
Types
::
BINARY
;
/** @deprecated Use {@see Types::BLOB} instead. */
public
const
BLOB
=
Types
::
BLOB
;
/** @deprecated Use {@see Types::BOOLEAN} instead. */
public
const
BOOLEAN
=
Types
::
BOOLEAN
;
/** @deprecated Use {@see Types::DATE_MUTABLE} instead. */
public
const
DATE
=
Types
::
DATE_MUTABLE
;
/** @deprecated Use {@see Types::DATE_IMMUTABLE} instead. */
public
const
DATE_IMMUTABLE
=
Types
::
DATE_IMMUTABLE
;
/** @deprecated Use {@see Types::DATEINTERVAL} instead. */
public
const
DATEINTERVAL
=
Types
::
DATEINTERVAL
;
/** @deprecated Use {@see Types::DATETIME_MUTABLE} instead. */
public
const
DATETIME
=
Types
::
DATETIME_MUTABLE
;
/** @deprecated Use {@see Types::DATETIME_IMMUTABLE} instead. */
public
const
DATETIME_IMMUTABLE
=
Types
::
DATETIME_IMMUTABLE
;
/** @deprecated Use {@see Types::DATETIMETZ_MUTABLE} instead. */
public
const
DATETIMETZ
=
Types
::
DATETIMETZ_MUTABLE
;
/** @deprecated Use {@see Types::DATETIMETZ_IMMUTABLE} instead. */
public
const
DATETIMETZ_IMMUTABLE
=
Types
::
DATETIMETZ_IMMUTABLE
;
/** @deprecated Use {@see Types::DECIMAL} instead. */
public
const
DECIMAL
=
Types
::
DECIMAL
;
/** @deprecated Use {@see Types::FLOAT} instead. */
public
const
FLOAT
=
Types
::
FLOAT
;
/** @deprecated Use {@see Types::GUID} instead. */
public
const
GUID
=
Types
::
GUID
;
/** @deprecated Use {@see Types::INTEGER} instead. */
public
const
INTEGER
=
Types
::
INTEGER
;
/** @deprecated Use {@see Types::JSON} instead. */
public
const
JSON
=
Types
::
JSON
;
/** @deprecated Use {@see Types::OBJECT} instead. */
public
const
OBJECT
=
Types
::
OBJECT
;
/** @deprecated Use {@see Types::SIMPLE_ARRAY} instead. */
public
const
SIMPLE_ARRAY
=
Types
::
SIMPLE_ARRAY
;
/** @deprecated Use {@see Types::SMALLINT} instead. */
public
const
SMALLINT
=
Types
::
SMALLINT
;
/** @deprecated Use {@see Types::STRING} instead. */
public
const
STRING
=
Types
::
STRING
;
/** @deprecated Use {@see Types::ARRAY} instead. */
public
const
TARRAY
=
Types
::
ARRAY
;
/** @deprecated Use {@see Types::TEXT} instead. */
public
const
TEXT
=
Types
::
TEXT
;
/** @deprecated Use {@see Types::TIME_MUTABLE} instead. */
public
const
TIME
=
Types
::
TIME_MUTABLE
;
/** @deprecated Use {@see Types::TIME_IMMUTABLE} instead. */
public
const
TIME_IMMUTABLE
=
Types
::
TIME_IMMUTABLE
;
/**
* The map of supported doctrine mapping types.
*/
...
...
src/Types/Types.php
View file @
138eb852
...
...
@@ -34,9 +34,6 @@ final class Types
public
const
TIME_MUTABLE
=
'time'
;
public
const
TIME_IMMUTABLE
=
'time_immutable'
;
/** @deprecated json_array type is deprecated, use {@see self::JSON} instead. */
public
const
JSON_ARRAY
=
'json_array'
;
private
function
__construct
()
{
}
...
...
tests/Platforms/PostgreSQL94PlatformTest.php
View file @
138eb852
...
...
@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Tests\Platforms;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\PostgreSQL94Platform
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
s
;
class
PostgreSQL94PlatformTest
extends
AbstractPostgreSQLPlatformTestCase
{
...
...
@@ -84,9 +84,9 @@ class PostgreSQL94PlatformTest extends AbstractPostgreSQLPlatformTestCase
public
function
testInitializesJsonTypeMapping
()
:
void
{
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'json'
));
self
::
assertEquals
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
self
::
assertEquals
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'json'
));
self
::
assertTrue
(
$this
->
platform
->
hasDoctrineTypeMappingFor
(
'jsonb'
));
self
::
assertEquals
(
Type
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'jsonb'
));
self
::
assertEquals
(
Type
s
::
JSON
,
$this
->
platform
->
getDoctrineTypeMapping
(
'jsonb'
));
}
/**
...
...
tests/Schema/ColumnTest.php
View file @
138eb852
...
...
@@ -6,6 +6,7 @@ use Doctrine\DBAL\Platforms\MySqlPlatform;
use
Doctrine\DBAL\Platforms\SqlitePlatform
;
use
Doctrine\DBAL\Platforms\SQLServer2012Platform
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\Exception\UnknownColumnOption
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Types
;
use
PHPUnit\Framework\TestCase
;
...
...
@@ -66,7 +67,8 @@ class ColumnTest extends TestCase
*/
public
function
testSettingUnknownOptionIsStillSupported
()
:
void
{
$this
->
expectNotToPerformAssertions
();
self
::
expectException
(
UnknownColumnOption
::
class
);
self
::
expectExceptionMessage
(
'The "unknown_option" column option is not supported.'
);
new
Column
(
'foo'
,
$this
->
createMock
(
Type
::
class
),
[
'unknown_option'
=>
'bar'
]);
}
...
...
@@ -77,6 +79,9 @@ class ColumnTest extends TestCase
*/
public
function
testOptionsShouldNotBeIgnored
()
:
void
{
self
::
expectException
(
UnknownColumnOption
::
class
);
self
::
expectExceptionMessage
(
'The "unknown_option" column option is not supported.'
);
$col1
=
new
Column
(
'bar'
,
Type
::
getType
(
Types
::
INTEGER
),
[
'unknown_option'
=>
'bar'
,
'notnull'
=>
true
]);
self
::
assertTrue
(
$col1
->
getNotnull
());
...
...
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