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
9bbf3d0f
Unverified
Commit
9bbf3d0f
authored
Nov 18, 2017
by
Luís Cobucci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve readability of AbstractPlatform#getDefaultValueDeclarationSQL()
parent
40a87b7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
19 deletions
+31
-19
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+31
-19
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
9bbf3d0f
...
...
@@ -2274,27 +2274,39 @@ abstract class AbstractPlatform
*/
public
function
getDefaultValueDeclarationSQL
(
$field
)
{
$default
=
empty
(
$field
[
'notnull'
])
?
' DEFAULT NULL'
:
''
;
if
(
isset
(
$field
[
'default'
]))
{
$default
=
" DEFAULT '"
.
$field
[
'default'
]
.
"'"
;
if
(
isset
(
$field
[
'type'
]))
{
$type
=
$field
[
'type'
];
if
(
$type
instanceof
Types\PhpIntegerMappingType
)
{
$default
=
" DEFAULT "
.
$field
[
'default'
];
}
elseif
(
$type
instanceof
Types\PhpDateTimeMappingType
&&
$field
[
'default'
]
===
$this
->
getCurrentTimestampSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
elseif
(
$type
instanceof
Types\TimeType
&&
$field
[
'default'
]
===
$this
->
getCurrentTimeSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentTimeSQL
();
}
elseif
(
$type
instanceof
Types\DateType
&&
$field
[
'default'
]
===
$this
->
getCurrentDateSQL
())
{
$default
=
" DEFAULT "
.
$this
->
getCurrentDateSQL
();
}
elseif
(
$type
instanceof
Types\BooleanType
)
{
$default
=
" DEFAULT '"
.
$this
->
convertBooleans
(
$field
[
'default'
])
.
"'"
;
}
}
if
(
!
isset
(
$field
[
'default'
]))
{
return
empty
(
$field
[
'notnull'
])
?
' DEFAULT NULL'
:
''
;
}
$default
=
$field
[
'default'
];
if
(
!
isset
(
$field
[
'type'
]))
{
return
" DEFAULT '"
.
$default
.
"'"
;
}
$type
=
$field
[
'type'
];
if
(
$type
instanceof
Types\PhpIntegerMappingType
)
{
return
" DEFAULT "
.
$default
;
}
if
(
$type
instanceof
Types\PhpDateTimeMappingType
&&
$default
===
$this
->
getCurrentTimestampSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentTimestampSQL
();
}
if
(
$type
instanceof
Types\TimeType
&&
$default
===
$this
->
getCurrentTimeSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentTimeSQL
();
}
if
(
$type
instanceof
Types\DateType
&&
$default
===
$this
->
getCurrentDateSQL
())
{
return
" DEFAULT "
.
$this
->
getCurrentDateSQL
();
}
if
(
$type
instanceof
Types\BooleanType
)
{
return
" DEFAULT '"
.
$this
->
convertBooleans
(
$default
)
.
"'"
;
}
return
$default
;
return
" DEFAULT '"
.
$default
.
"'"
;
}
/**
...
...
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