![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/beberlei/doctrineextensions/src/Types/ |
<?php namespace DoctrineExtensions\Types; use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Types\ConversionException; use Doctrine\DBAL\Types\Type; if (!class_exists('Zend_Date')) { require_once 'Zend/Date.php'; } /** * Type that maps an SQL DATETIME/TIMESTAMP to a Zend_Date object. * * @author Andreas Gallien <[email protected]> */ class ZendDateType extends Type { const ZENDDATE = 'zenddate'; public function getName() { return self::ZENDDATE; } public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { return $platform->getDateTimeTypeDeclarationSQL($fieldDeclaration); } public function convertToDatabaseValue($value, AbstractPlatform $platform) { return ($value !== null) ? $value->toString(\Zend_Locale_Format::convertPhpToIsoFormat( $platform->getDateTimeFormatString() )) : null; } public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null) { return; } $dateTimeFormatString = \Zend_Locale_Format::convertPhpToIsoFormat( $platform->getDateTimeFormatString() ); $val = new \Zend_Date($value, $dateTimeFormatString); if (!$val) { throw ConversionException::conversionFailed($value, $this->getName()); } return $val; } public function requiresSQLCommentHint(AbstractPlatform $platform) { return true; } }