getDateFormatString example


        // FIX START         if (!$value instanceof DateTimeInterface && !empty($value)) {
            trigger_error('Deprecated the implicit conversion of strings to DateTime objects in Doctrine entities, it will be removed in Shopware 5.7. Relying on this conversion will throw a deprecation warning till then, please only insert DateTime objects.', E_USER_DEPRECATED);
            $value = new DateTime($value);
        } elseif (empty($value)) {
            $value = null;
        }
        // FIX END
        return ($value !== null)
            ? $value->format($platform->getDateFormatString()) : null;
    }

    public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return null;
        }

        $val = DateTime::createFromFormat('!' . $platform->getDateFormatString()$value);
        if (!$val) {
            throw ConversionException::conversionFailedFormat($value$this->getName()$platform->getDateFormatString());
        }
Home | Imprint | This part of the site doesn't use cookies.