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
3c604541
Unverified
Commit
3c604541
authored
Jul 28, 2017
by
Marco Pivetta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#2794 simplifying date/time instance checking by comparing against `DateTimeInterface` instead
parent
7388a78c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
DateTimeType.php
lib/Doctrine/DBAL/Types/DateTimeType.php
+2
-2
DateTimeTzType.php
lib/Doctrine/DBAL/Types/DateTimeTzType.php
+2
-2
DateType.php
lib/Doctrine/DBAL/Types/DateType.php
+2
-2
TimeType.php
lib/Doctrine/DBAL/Types/TimeType.php
+2
-2
No files found.
lib/Doctrine/DBAL/Types/DateTimeType.php
View file @
3c604541
...
@@ -53,7 +53,7 @@ class DateTimeType extends Type
...
@@ -53,7 +53,7 @@ class DateTimeType extends Type
return
$value
;
return
$value
;
}
}
if
(
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
->
format
(
$platform
->
getDateTimeFormatString
());
return
$value
->
format
(
$platform
->
getDateTimeFormatString
());
}
}
...
@@ -65,7 +65,7 @@ class DateTimeType extends Type
...
@@ -65,7 +65,7 @@ class DateTimeType extends Type
*/
*/
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
;
return
$value
;
}
}
...
...
lib/Doctrine/DBAL/Types/DateTimeTzType.php
View file @
3c604541
...
@@ -71,7 +71,7 @@ class DateTimeTzType extends Type
...
@@ -71,7 +71,7 @@ class DateTimeTzType extends Type
return
$value
;
return
$value
;
}
}
if
(
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
->
format
(
$platform
->
getDateTimeTzFormatString
());
return
$value
->
format
(
$platform
->
getDateTimeTzFormatString
());
}
}
...
@@ -83,7 +83,7 @@ class DateTimeTzType extends Type
...
@@ -83,7 +83,7 @@ class DateTimeTzType extends Type
*/
*/
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
;
return
$value
;
}
}
...
...
lib/Doctrine/DBAL/Types/DateType.php
View file @
3c604541
...
@@ -53,7 +53,7 @@ class DateType extends Type
...
@@ -53,7 +53,7 @@ class DateType extends Type
return
$value
;
return
$value
;
}
}
if
(
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
->
format
(
$platform
->
getDateFormatString
());
return
$value
->
format
(
$platform
->
getDateFormatString
());
}
}
...
@@ -65,7 +65,7 @@ class DateType extends Type
...
@@ -65,7 +65,7 @@ class DateType extends Type
*/
*/
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
;
return
$value
;
}
}
...
...
lib/Doctrine/DBAL/Types/TimeType.php
View file @
3c604541
...
@@ -53,7 +53,7 @@ class TimeType extends Type
...
@@ -53,7 +53,7 @@ class TimeType extends Type
return
$value
;
return
$value
;
}
}
if
(
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
->
format
(
$platform
->
getTimeFormatString
());
return
$value
->
format
(
$platform
->
getTimeFormatString
());
}
}
...
@@ -65,7 +65,7 @@ class TimeType extends Type
...
@@ -65,7 +65,7 @@ class TimeType extends Type
*/
*/
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
public
function
convertToPHPValue
(
$value
,
AbstractPlatform
$platform
)
{
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
||
$value
instanceof
\DateTimeImmutabl
e
)
{
if
(
$value
===
null
||
$value
instanceof
\DateTime
Interfac
e
)
{
return
$value
;
return
$value
;
}
}
...
...
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