PATH:
home
/
lab2454c
/
costbloc.com
/
vendor
/
doctrine
/
dbal
/
src
/
Types
<?php namespace Doctrine\DBAL\Types; use DateTime; use DateTimeInterface; use Doctrine\DBAL\Platforms\AbstractPlatform; use function date_create; /** * Type that maps an SQL DATETIME/TIMESTAMP to a PHP DateTime object. */ class DateTimeType extends Type implements PhpDateTimeMappingType { /** * {@inheritdoc} */ public function getName() { return Types::DATETIME_MUTABLE; } /** * {@inheritdoc} */ public function getSQLDeclaration(array $column, AbstractPlatform $platform) { return $platform->getDateTimeTypeDeclarationSQL($column); } /** * {@inheritdoc} */ public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return $value; } if ($value instanceof DateTimeInterface) { return $value->format($platform->getDateTimeFormatString()); } throw ConversionException::conversionFailedInvalidType($value, $this->getName(), ['null', 'DateTime']); } /** * {@inheritdoc} */ public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value instanceof DateTimeInterface) { return $value; } $val = DateTime::createFromFormat($platform->getDateTimeFormatString(), $value); if ($val === false) { $val = date_create($value); } if ($val === false) { throw ConversionException::conversionFailedFormat( $value, $this->getName(), $platform->getDateTimeFormatString(), ); } return $val; } }
[-] TimeType.php
[edit]
[-] TimeImmutableType.php
[edit]
[-] DateTimeTzType.php
[edit]
[-] DateTimeType.php
[edit]
[-] PhpDateTimeMappingType.php
[edit]
[-] Types.php
[edit]
[-] ConversionException.php
[edit]
[-] ArrayType.php
[edit]
[+]
..
[-] GuidType.php
[edit]
[-] FloatType.php
[edit]
[-] TypeRegistry.php
[edit]
[-] Type.php
[edit]
[-] DateImmutableType.php
[edit]
[-] StringType.php
[edit]
[-] BooleanType.php
[edit]
[-] BigIntType.php
[edit]
[-] DateTimeImmutableType.php
[edit]
[-] DateTimeTzImmutableType.php
[edit]
[-] PhpIntegerMappingType.php
[edit]
[-] BlobType.php
[edit]
[-] SmallIntType.php
[edit]
[-] ObjectType.php
[edit]
[-] DecimalType.php
[edit]
[-] TextType.php
[edit]
[-] AsciiStringType.php
[edit]
[-] BinaryType.php
[edit]
[-] SimpleArrayType.php
[edit]
[-] IntegerType.php
[edit]
[-] VarDateTimeImmutableType.php
[edit]
[-] VarDateTimeType.php
[edit]
[-] JsonType.php
[edit]
[-] DateType.php
[edit]
[-] DateIntervalType.php
[edit]