mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
date value object toString, deprecate getString
This commit is contained in:
@@ -57,7 +57,7 @@ class Exports implements Cleanup
|
||||
|
||||
$before = DateTime::createNow()
|
||||
->modify($period)
|
||||
->getString();
|
||||
->toString();
|
||||
|
||||
$delete = $this->entityManager
|
||||
->getQueryBuilder()
|
||||
|
||||
@@ -55,7 +55,7 @@ class MassActions implements Cleanup
|
||||
|
||||
$before = DateTime::createNow()
|
||||
->modify($period)
|
||||
->getString();
|
||||
->toString();
|
||||
|
||||
$delete = $this->entityManager
|
||||
->getQueryBuilder()
|
||||
|
||||
@@ -56,7 +56,7 @@ class PasswordChangeRequests implements Cleanup
|
||||
|
||||
$before = DateTime::createNow()
|
||||
->modify($period)
|
||||
->getString();
|
||||
->toString();
|
||||
|
||||
$delete = $this->entityManager
|
||||
->getQueryBuilder()
|
||||
|
||||
@@ -122,7 +122,7 @@ class Subscribers implements Cleanup
|
||||
),
|
||||
Cond::less(
|
||||
Cond::column('entity.' . $dateField),
|
||||
$before->getString()
|
||||
$before->toString()
|
||||
),
|
||||
Cond::in(
|
||||
Cond::column('entity.' . $statusField),
|
||||
|
||||
@@ -93,7 +93,7 @@ class BeforeUpdatePreserveDuration implements UpdateHook
|
||||
|
||||
$dateEndModified = $dateStart->add($diff);
|
||||
|
||||
$entity->set('dateEnd', $dateEndModified->getString());
|
||||
$entity->set('dateEnd', $dateEndModified->toString());
|
||||
}
|
||||
|
||||
private function processDate(Entity $entity): void
|
||||
@@ -114,6 +114,6 @@ class BeforeUpdatePreserveDuration implements UpdateHook
|
||||
|
||||
$dateEndModified = $dateStart->add($diff);
|
||||
|
||||
$entity->set('dateEndDate', $dateEndModified->getString());
|
||||
$entity->set('dateEndDate', $dateEndModified->toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class Actual implements Filter
|
||||
$queryBuilder->where(
|
||||
Expression::greaterOrEqual(
|
||||
Expression::column('dateEnd'),
|
||||
Date::createToday()->getString()
|
||||
Date::createToday()->toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class KeysProvider
|
||||
|
||||
$period = '-' . $this->configDataProvider->getJwksCachePeriod();
|
||||
|
||||
if ($timestamp < DateTime::createNow()->modify($period)->getTimestamp()) {
|
||||
if ($timestamp < DateTime::createNow()->modify($period)->toTimestamp()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ class Util
|
||||
|
||||
$from = DateTime::createNow()
|
||||
->modify('-' . $period)
|
||||
->getString();
|
||||
->toString();
|
||||
|
||||
$count = $this->entityManager
|
||||
->getRDBRepository(TwoFactorCode::ENTITY_TYPE)
|
||||
|
||||
@@ -239,7 +239,7 @@ class Util
|
||||
|
||||
$from = DateTime::createNow()
|
||||
->modify('-' . $period)
|
||||
->getString();
|
||||
->toString();
|
||||
|
||||
$count = $this->entityManager
|
||||
->getRDBRepository(TwoFactorCode::ENTITY_TYPE)
|
||||
|
||||
@@ -77,7 +77,7 @@ class Date implements DateTimeable
|
||||
/**
|
||||
* Get a string value in `Y-m-d` format.
|
||||
*/
|
||||
public function getString(): string
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ class Date implements DateTimeable
|
||||
/**
|
||||
* Get DateTimeImmutable.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
public function toDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->dateTime;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ class Date implements DateTimeable
|
||||
/**
|
||||
* Get a timestamp.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
public function toTimestamp(): int
|
||||
{
|
||||
return $this->dateTime->getTimestamp();
|
||||
}
|
||||
@@ -200,7 +200,7 @@ class Date implements DateTimeable
|
||||
*/
|
||||
public function diff(DateTimeable $other): DateInterval
|
||||
{
|
||||
return $this->getDateTime()->diff($other->getDateTime());
|
||||
return $this->toDateTime()->diff($other->toDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +208,7 @@ class Date implements DateTimeable
|
||||
*/
|
||||
public function isGreaterThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() > $other->getDateTime();
|
||||
return $this->toDateTime() > $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ class Date implements DateTimeable
|
||||
*/
|
||||
public function isLessThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() < $other->getDateTime();
|
||||
return $this->toDateTime() < $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ class Date implements DateTimeable
|
||||
*/
|
||||
public function isEqualTo(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() == $other->getDateTime();
|
||||
return $this->toDateTime() == $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,4 +258,31 @@ class Date implements DateTimeable
|
||||
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toString` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getString(): string
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toDateTime` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `getTimestamp` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
{
|
||||
return $this->toTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class DateAttributeExtractor implements AttributeExtractor
|
||||
}
|
||||
|
||||
return (object) [
|
||||
$field => $value->getString(),
|
||||
$field => $value->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class DateTime implements DateTimeable
|
||||
/**
|
||||
* Get a string value in `Y-m-d H:i:s` format.
|
||||
*/
|
||||
public function getString(): string
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class DateTime implements DateTimeable
|
||||
/**
|
||||
* Get DateTimeImmutable.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
public function toDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->dateTime;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class DateTime implements DateTimeable
|
||||
/**
|
||||
* Get a timestamp.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
public function toTimestamp(): int
|
||||
{
|
||||
return $this->dateTime->getTimestamp();
|
||||
}
|
||||
@@ -266,7 +266,7 @@ class DateTime implements DateTimeable
|
||||
*/
|
||||
public function diff(DateTimeable $other): DateInterval
|
||||
{
|
||||
return $this->getDateTime()->diff($other->getDateTime());
|
||||
return $this->toDateTime()->diff($other->toDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,7 +298,7 @@ class DateTime implements DateTimeable
|
||||
*/
|
||||
public function isGreaterThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() > $other->getDateTime();
|
||||
return $this->toDateTime() > $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,7 +306,7 @@ class DateTime implements DateTimeable
|
||||
*/
|
||||
public function isLessThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() < $other->getDateTime();
|
||||
return $this->toDateTime() < $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,7 +314,7 @@ class DateTime implements DateTimeable
|
||||
*/
|
||||
public function isEqualTo(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() == $other->getDateTime();
|
||||
return $this->toDateTime() == $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -365,4 +365,31 @@ class DateTime implements DateTimeable
|
||||
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toString` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getString(): string
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toDateTime` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `getTimestamp` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
{
|
||||
return $this->toTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class DateTimeAttributeExtractor implements AttributeExtractor
|
||||
}
|
||||
|
||||
return (object) [
|
||||
$field => $value->getString(),
|
||||
$field => $value->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ use DateTimeImmutable;
|
||||
|
||||
interface DateTimeable
|
||||
{
|
||||
public function getDateTime(): DateTimeImmutable;
|
||||
public function toDateTime(): DateTimeImmutable;
|
||||
}
|
||||
|
||||
@@ -83,25 +83,25 @@ class DateTimeOptional implements DateTimeable
|
||||
/**
|
||||
* Get a string value in `Y-m-d H:i:s` format.
|
||||
*/
|
||||
public function getString(): string
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->getActualValue()->getString();
|
||||
return $this->getActualValue()->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DateTimeImmutable.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
public function toDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->getActualValue()->getDateTime();
|
||||
return $this->getActualValue()->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a timestamp.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
public function toTimestamp(): int
|
||||
{
|
||||
return $this->getActualValue()->getDateTime()->getTimestamp();
|
||||
return $this->getActualValue()->toDateTime()->getTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,7 +194,7 @@ class DateTimeOptional implements DateTimeable
|
||||
*/
|
||||
public function getTimezone(): DateTimeZone
|
||||
{
|
||||
return $this->getDateTime()->getTimezone();
|
||||
return $this->toDateTime()->getTimezone();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +212,7 @@ class DateTimeOptional implements DateTimeable
|
||||
public function withTimezone(DateTimeZone $timezone): self
|
||||
{
|
||||
if ($this->isAllDay()) {
|
||||
$dateTime = $this->getActualValue()->getDateTime()->setTimezone($timezone);
|
||||
$dateTime = $this->getActualValue()->toDateTime()->setTimezone($timezone);
|
||||
|
||||
return self::fromDateTime($dateTime);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ class DateTimeOptional implements DateTimeable
|
||||
/** @var DateTime $value */
|
||||
$value = $this->getActualValue();
|
||||
|
||||
$dateTime = $value->withTimezone($timezone)->getDateTime();
|
||||
$dateTime = $value->withTimezone($timezone)->toDateTime();
|
||||
|
||||
return self::fromDateTime($dateTime);
|
||||
}
|
||||
@@ -231,10 +231,10 @@ class DateTimeOptional implements DateTimeable
|
||||
public function withTime(?int $hour, ?int $minute, ?int $second = 0): self
|
||||
{
|
||||
if ($this->isAllDay()) {
|
||||
$dateTime = DateTime::fromDateTime($this->getActualValue()->getDateTime())
|
||||
$dateTime = DateTime::fromDateTime($this->getActualValue()->toDateTime())
|
||||
->withTime($hour, $minute, $second);
|
||||
|
||||
return self::fromDateTime($dateTime->getDateTime());
|
||||
return self::fromDateTime($dateTime->toDateTime());
|
||||
}
|
||||
|
||||
/** @var DateTime $value */
|
||||
@@ -242,7 +242,7 @@ class DateTimeOptional implements DateTimeable
|
||||
|
||||
$dateTime = $value->withTime($hour, $minute, $second);
|
||||
|
||||
return self::fromDateTime($dateTime->getDateTime());
|
||||
return self::fromDateTime($dateTime->toDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,14 +254,14 @@ class DateTimeOptional implements DateTimeable
|
||||
assert($this->dateValue !== null);
|
||||
|
||||
return self::fromDateTimeAllDay(
|
||||
$this->dateValue->modify($modifier)->getDateTime()
|
||||
$this->dateValue->modify($modifier)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
assert($this->dateTimeValue !== null);
|
||||
|
||||
return self::fromDateTime(
|
||||
$this->dateTimeValue->modify($modifier)->getDateTime()
|
||||
$this->dateTimeValue->modify($modifier)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -274,14 +274,14 @@ class DateTimeOptional implements DateTimeable
|
||||
assert($this->dateValue !== null);
|
||||
|
||||
return self::fromDateTimeAllDay(
|
||||
$this->dateValue->add($interval)->getDateTime()
|
||||
$this->dateValue->add($interval)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
assert($this->dateTimeValue !== null);
|
||||
|
||||
return self::fromDateTime(
|
||||
$this->dateTimeValue->add($interval)->getDateTime()
|
||||
$this->dateTimeValue->add($interval)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -294,14 +294,14 @@ class DateTimeOptional implements DateTimeable
|
||||
assert($this->dateValue !== null);
|
||||
|
||||
return self::fromDateTimeAllDay(
|
||||
$this->dateValue->subtract($interval)->getDateTime()
|
||||
$this->dateValue->subtract($interval)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
assert($this->dateTimeValue !== null);
|
||||
|
||||
return self::fromDateTime(
|
||||
$this->dateTimeValue->subtract($interval)->getDateTime()
|
||||
$this->dateTimeValue->subtract($interval)->toDateTime()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ class DateTimeOptional implements DateTimeable
|
||||
*/
|
||||
public function diff(DateTimeable $other): DateInterval
|
||||
{
|
||||
return $this->getDateTime()->diff($other->getDateTime());
|
||||
return $this->toDateTime()->diff($other->toDateTime());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,7 +378,7 @@ class DateTimeOptional implements DateTimeable
|
||||
*/
|
||||
public function isGreaterThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() > $other->getDateTime();
|
||||
return $this->toDateTime() > $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -386,7 +386,7 @@ class DateTimeOptional implements DateTimeable
|
||||
*/
|
||||
public function isLessThan(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() < $other->getDateTime();
|
||||
return $this->toDateTime() < $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,7 +394,7 @@ class DateTimeOptional implements DateTimeable
|
||||
*/
|
||||
public function isEqualTo(DateTimeable $other): bool
|
||||
{
|
||||
return $this->getDateTime() == $other->getDateTime();
|
||||
return $this->toDateTime() == $other->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -484,4 +484,31 @@ class DateTimeOptional implements DateTimeable
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toString` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getString(): string
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `toDateTime` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getDateTime(): DateTimeImmutable
|
||||
{
|
||||
return $this->toDateTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated As of v8.1. Use `getTimestamp` instead.
|
||||
* @todo Remove in v10.0.
|
||||
*/
|
||||
public function getTimestamp(): int
|
||||
{
|
||||
return $this->toTimestamp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ class DateTimeOptionalAttributeExtractor implements AttributeExtractor
|
||||
|
||||
if ($value->isAllDay()) {
|
||||
return (object) [
|
||||
$field . 'Date' => $value->getString(),
|
||||
$field . 'Date' => $value->toString(),
|
||||
$field => null,
|
||||
];
|
||||
}
|
||||
|
||||
return (object) [
|
||||
$field => $value->getString(),
|
||||
$field => $value->toString(),
|
||||
$field . 'Date' => null,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class AddWorkingDaysType extends Base
|
||||
$dateTime = $dateTime->withTimezone($calendar->getTimezone());
|
||||
}
|
||||
|
||||
$dateTime = DateTime::fromDateTime($dateTime->getDateTime());
|
||||
$dateTime = DateTime::fromDateTime($dateTime->toDateTime());
|
||||
|
||||
$result = $this->createCalendarUtility($calendar)->addWorkingDays($dateTime, $days);
|
||||
|
||||
@@ -83,9 +83,9 @@ class AddWorkingDaysType extends Base
|
||||
}
|
||||
|
||||
if ($isAllDay) {
|
||||
return $result->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT);
|
||||
return $result->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT);
|
||||
}
|
||||
|
||||
return $result->getString();
|
||||
return $result->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,6 +66,6 @@ class FindClosestWorkingTimeType extends Base
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result->getString();
|
||||
return $result->toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ class FetchData
|
||||
return;
|
||||
}
|
||||
|
||||
$this->data->lastDate->$folder = $lastDate->getString();
|
||||
$this->data->lastDate->$folder = $lastDate->toString();
|
||||
}
|
||||
|
||||
public function setForceByDate(string $folder, bool $forceByDate): void
|
||||
|
||||
@@ -170,7 +170,7 @@ class Fetcher
|
||||
if ($email && $email->getDateSent()) {
|
||||
$lastDate = $email->getDateSent();
|
||||
|
||||
if ($lastDate->getTimestamp() >= (new DateTime())->getTimestamp()) {
|
||||
if ($lastDate->toTimestamp() >= (new DateTime())->getTimestamp()) {
|
||||
$lastDate = DateTimeField::createNow();
|
||||
}
|
||||
}
|
||||
@@ -237,7 +237,7 @@ class Fetcher
|
||||
throw new Error("{$account->getEntityType()} {$account->getId()}, no fetch-since.");
|
||||
}
|
||||
|
||||
$fetchSince = $account->getFetchSince()->getDateTime();
|
||||
$fetchSince = $account->getFetchSince()->toDateTime();
|
||||
|
||||
return $storage->getIdsSinceDate(
|
||||
DateTimeField::fromDateTime($fetchSince)
|
||||
|
||||
@@ -79,7 +79,7 @@ class LaminasStorage implements Storage
|
||||
public function getIdsSinceDate(DateTime $since): array
|
||||
{
|
||||
return $this->imap->getIdsSinceDate(
|
||||
$since->getDateTime()->format('d-M-Y')
|
||||
$since->toDateTime()->format('d-M-Y')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -598,7 +598,7 @@ class Sender
|
||||
$this->transport->send($message);
|
||||
|
||||
$email->setStatus(Email::STATUS_SENT);
|
||||
$email->set('dateSent', DateTime::createNow()->getString());
|
||||
$email->set('dateSent', DateTime::createNow()->toString());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
/** @noinspection PhpDeprecationInspection */
|
||||
|
||||
@@ -959,7 +959,7 @@ class ItemGeneralConverter implements ItemConverter
|
||||
->withTimezone($this->getSystemTimeZone());
|
||||
|
||||
return [
|
||||
$attribute . '=' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '=' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -972,7 +972,7 @@ class ItemGeneralConverter implements ItemConverter
|
||||
->withTimezone($this->getSystemTimeZone());
|
||||
|
||||
return [
|
||||
$attribute . '<' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -985,7 +985,7 @@ class ItemGeneralConverter implements ItemConverter
|
||||
->withTimezone($this->getSystemTimeZone());
|
||||
|
||||
return [
|
||||
$attribute . '>' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1001,8 +1001,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1022,8 +1022,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1043,8 +1043,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $today->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $today->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<=' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1062,7 +1062,7 @@ class ItemGeneralConverter implements ItemConverter
|
||||
->addDays(- $number);
|
||||
|
||||
return [
|
||||
$attribute . '<' => $date->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $date->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1079,7 +1079,7 @@ class ItemGeneralConverter implements ItemConverter
|
||||
->addDays($number);
|
||||
|
||||
return [
|
||||
$attribute . '>' => $date->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>' => $date->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1096,8 +1096,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1115,8 +1115,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1134,8 +1134,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1158,8 +1158,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1189,8 +1189,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1208,8 +1208,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1227,8 +1227,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1255,8 +1255,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1284,8 +1284,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1311,8 +1311,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1339,8 +1339,8 @@ class ItemGeneralConverter implements ItemConverter
|
||||
|
||||
return [
|
||||
'AND' => [
|
||||
$attribute . '>=' => $from->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '>=' => $from->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
$attribute . '<' => $to->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_FORMAT),
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class AuthToken extends BaseEntity implements AuthTokenInterface
|
||||
|
||||
public function setLastAccessNow(): self
|
||||
{
|
||||
$this->set('lastAccess', DateTime::createNow()->getString());
|
||||
$this->set('lastAccess', DateTime::createNow()->toString());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class Sms extends Entity implements SmsInterface
|
||||
$this->set('status', Sms::STATUS_SENT);
|
||||
|
||||
if (!$this->get('dateSent')) {
|
||||
$this->set('dateSent', DateTime::createNow()->getString());
|
||||
$this->set('dateSent', DateTime::createNow()->toString());
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -58,8 +58,8 @@ class BusyRange implements Item
|
||||
public function getRaw(): stdClass
|
||||
{
|
||||
return (object) [
|
||||
'dateStart' => $this->start->getString(),
|
||||
'dateEnd' => $this->end->getString(),
|
||||
'dateStart' => $this->start->toString(),
|
||||
'dateEnd' => $this->end->toString(),
|
||||
'isBusyRange' => true,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ class Event implements Item
|
||||
{
|
||||
$obj = (object) [
|
||||
'scope' => $this->entityType,
|
||||
'dateStart' => $this->start?->getString(),
|
||||
'dateEnd' => $this->end?->getString(),
|
||||
'dateStart' => $this->start?->toString(),
|
||||
'dateEnd' => $this->end?->toString(),
|
||||
];
|
||||
|
||||
if ($this->userIdList !== []) {
|
||||
|
||||
@@ -57,8 +57,8 @@ class NonWorkingRange implements Item
|
||||
public function getRaw(): stdClass
|
||||
{
|
||||
return (object) [
|
||||
'dateStart' => $this->start->getString(),
|
||||
'dateEnd' => $this->end->getString(),
|
||||
'dateStart' => $this->start->toString(),
|
||||
'dateEnd' => $this->end->toString(),
|
||||
'isNonWorkingRange' => true,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -58,8 +58,8 @@ class WorkingRange implements Item
|
||||
public function getRaw(): stdClass
|
||||
{
|
||||
return (object) [
|
||||
'dateStart' => $this->start->getString(),
|
||||
'dateEnd' => $this->end->getString(),
|
||||
'dateStart' => $this->start->toString(),
|
||||
'dateEnd' => $this->end->toString(),
|
||||
'isWorkingRange' => true,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ class Service
|
||||
*/
|
||||
public function fetch(string $userId, FetchParams $fetchParams): array
|
||||
{
|
||||
$from = $fetchParams->getFrom()->getString();
|
||||
$to = $fetchParams->getTo()->getString();
|
||||
$from = $fetchParams->getFrom()->toString();
|
||||
$to = $fetchParams->getTo()->toString();
|
||||
$scopeList = $fetchParams->getScopeList();
|
||||
$skipAcl = $fetchParams->skipAcl();
|
||||
|
||||
@@ -784,26 +784,26 @@ class Service
|
||||
try {
|
||||
foreach ($rangeList as $range) {
|
||||
if (
|
||||
$start->getTimestamp() < $range->start->getTimestamp() &&
|
||||
$end->getTimestamp() > $range->end->getTimestamp()
|
||||
$start->toTimestamp() < $range->start->getTimestamp() &&
|
||||
$end->toTimestamp() > $range->end->getTimestamp()
|
||||
) {
|
||||
$range->dateStart = $start->getString();
|
||||
$range->dateStart = $start->toString();
|
||||
$range->start = $start;
|
||||
$range->dateEnd = $end->getString();
|
||||
$range->dateEnd = $end->toString();
|
||||
$range->end = $end;
|
||||
|
||||
continue 2;
|
||||
}
|
||||
|
||||
if (
|
||||
$start->getTimestamp() < $range->start->getTimestamp() &&
|
||||
$end->getTimestamp() > $range->start->getTimestamp()
|
||||
$start->toTimestamp() < $range->start->getTimestamp() &&
|
||||
$end->toTimestamp() > $range->start->getTimestamp()
|
||||
) {
|
||||
$range->dateStart = $start->getString();
|
||||
$range->dateStart = $start->toString();
|
||||
$range->start = $start;
|
||||
|
||||
if ($end->getTimestamp() > $range->end->getTimestamp()) {
|
||||
$range->dateEnd = $end->getString();
|
||||
if ($end->toTimestamp() > $range->end->getTimestamp()) {
|
||||
$range->dateEnd = $end->toString();
|
||||
$range->end = $end;
|
||||
}
|
||||
|
||||
@@ -811,14 +811,14 @@ class Service
|
||||
}
|
||||
|
||||
if (
|
||||
$start->getTimestamp() < $range->end->getTimestamp() &&
|
||||
$end->getTimestamp() > $range->end->getTimestamp()
|
||||
$start->toTimestamp() < $range->end->getTimestamp() &&
|
||||
$end->toTimestamp() > $range->end->getTimestamp()
|
||||
) {
|
||||
$range->dateEnd = $end->getString();
|
||||
$range->dateEnd = $end->toString();
|
||||
$range->end = $end;
|
||||
|
||||
if ($start->getTimestamp() < $range->start->getTimestamp()) {
|
||||
$range->dateStart = $start->getString();
|
||||
if ($start->toTimestamp() < $range->start->getTimestamp()) {
|
||||
$range->dateStart = $start->toString();
|
||||
$range->start = $start;
|
||||
}
|
||||
|
||||
@@ -827,8 +827,8 @@ class Service
|
||||
}
|
||||
|
||||
$busyItem = (object) [
|
||||
'dateStart' => $start->getString(),
|
||||
'dateEnd' => $end->getString(),
|
||||
'dateStart' => $start->toString(),
|
||||
'dateEnd' => $end->toString(),
|
||||
'start' => $start,
|
||||
'end' => $end,
|
||||
];
|
||||
@@ -926,7 +926,7 @@ class Service
|
||||
$toReturn = true;
|
||||
|
||||
try {
|
||||
$diff = $to->getDateTime()->diff($from->getDateTime(), true);
|
||||
$diff = $to->toDateTime()->diff($from->toDateTime(), true);
|
||||
|
||||
if ($diff->days > $this->config->get('busyRangesMaxRange', self::BUSY_RANGES_MAX_RANGE_DAYS)) {
|
||||
$toReturn = false;
|
||||
|
||||
@@ -61,7 +61,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $target->getId(),
|
||||
'parentType' => $target->getEntityType(),
|
||||
'action' => CampaignLogRecord::ACTION_LEAD_CREATED,
|
||||
@@ -81,7 +81,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $queueItem->getTargetId(),
|
||||
'parentType' => $queueItem->getTargetType(),
|
||||
'action' => CampaignLogRecord::ACTION_SENT,
|
||||
@@ -125,7 +125,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $queueItem->getTargetId(),
|
||||
'parentType' => $queueItem->getTargetType(),
|
||||
'action' => CampaignLogRecord::ACTION_BOUNCED,
|
||||
@@ -184,7 +184,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $target->getId(),
|
||||
'parentType' => $target->getEntityType(),
|
||||
'action' => CampaignLogRecord::ACTION_OPTED_IN,
|
||||
@@ -235,7 +235,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $target->getId(),
|
||||
'parentType' => $target->getEntityType(),
|
||||
'action' => CampaignLogRecord::ACTION_OPTED_OUT,
|
||||
@@ -281,7 +281,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $queueItem->getTargetId(),
|
||||
'parentType' => $queueItem->getTargetType(),
|
||||
'action' => CampaignLogRecord::ACTION_OPENED,
|
||||
@@ -325,7 +325,7 @@ class LogService
|
||||
|
||||
$logRecord->set([
|
||||
'campaignId' => $campaignId,
|
||||
'actionDate' => $actionDate->getString(),
|
||||
'actionDate' => $actionDate->toString(),
|
||||
'parentId' => $queueItem->getTargetId(),
|
||||
'parentType' => $queueItem->getTargetType(),
|
||||
'action' => CampaignLogRecord::ACTION_CLICKED,
|
||||
|
||||
@@ -100,20 +100,20 @@ class ByLeadSource
|
||||
|
||||
if ($from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if ($from && !$to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if (!$from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -99,20 +99,20 @@ class ByStage
|
||||
|
||||
if ($from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if ($from && !$to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if (!$from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
$queryBuilder
|
||||
|
||||
@@ -97,8 +97,8 @@ class SalesByMonth
|
||||
];
|
||||
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
|
||||
$queryBuilder
|
||||
@@ -138,8 +138,8 @@ class SalesByMonth
|
||||
$dtTo = $dtTo->addDays(1 - $dtTo->getDay());
|
||||
}
|
||||
|
||||
while ($dt->getTimestamp() < $dtTo->getTimestamp()) {
|
||||
$month = $dt->getDateTime()->format('Y-m');
|
||||
while ($dt->toTimestamp() < $dtTo->toTimestamp()) {
|
||||
$month = $dt->toDateTime()->format('Y-m');
|
||||
|
||||
if (!array_key_exists($month, $result)) {
|
||||
$result[$month] = 0;
|
||||
|
||||
@@ -107,20 +107,20 @@ class SalesPipeline
|
||||
|
||||
if ($from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if ($from && !$to) {
|
||||
$whereClause[] = [
|
||||
'closeDate>=' => $from->getString(),
|
||||
'closeDate>=' => $from->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
if (!$from && $to) {
|
||||
$whereClause[] = [
|
||||
'closeDate<' => $to->getString(),
|
||||
'closeDate<' => $to->toString(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ class MoveToStorage implements Job
|
||||
->setTime(
|
||||
DateTime::createNow()
|
||||
->modify('+' . self::REMOVE_FILE_PERIOD)
|
||||
->getDateTime()
|
||||
->toDateTime()
|
||||
)
|
||||
->schedule();
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class OpenSpoutProcessor implements ProcessorInterface
|
||||
$style = new Style();
|
||||
$style->setFormat($dateFormat);
|
||||
|
||||
return Cell\DateTimeCell::fromValue($value->getDateTime(), $style);
|
||||
return Cell\DateTimeCell::fromValue($value->toDateTime(), $style);
|
||||
}
|
||||
|
||||
if ($value instanceof DateTime) {
|
||||
@@ -204,7 +204,7 @@ class OpenSpoutProcessor implements ProcessorInterface
|
||||
$style = new Style();
|
||||
$style->setFormat($dateTimeFormat);
|
||||
|
||||
return Cell\DateTimeCell::fromValue($value->getDateTime(), $style);
|
||||
return Cell\DateTimeCell::fromValue($value->toDateTime(), $style);
|
||||
}
|
||||
|
||||
if ($value instanceof Currency) {
|
||||
|
||||
@@ -422,7 +422,7 @@ class PhpSpreadsheetProcessor implements ProcessorInterface
|
||||
$sheet->setCellValue(
|
||||
$coordinate,
|
||||
SharedDate::PHPToExcel(
|
||||
strtotime($value->getString())
|
||||
strtotime($value->toString())
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -430,7 +430,7 @@ class PhpSpreadsheetProcessor implements ProcessorInterface
|
||||
$sheet->setCellValue(
|
||||
$coordinate,
|
||||
SharedDate::PHPToExcel(
|
||||
strtotime($value->getDateTime()->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT))
|
||||
strtotime($value->toDateTime()->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ class CaptureService
|
||||
|
||||
$terminateAt = $uniqueId->getTerminateAt();
|
||||
|
||||
if ($terminateAt && time() > strtotime($terminateAt->getString())) {
|
||||
if ($terminateAt && time() > strtotime($terminateAt->toString())) {
|
||||
return new ConfirmResult(
|
||||
ConfirmResult::STATUS_EXPIRED,
|
||||
$this->defaultLanguage
|
||||
|
||||
@@ -112,7 +112,7 @@ class ConfirmationSender
|
||||
|
||||
$terminateAt = $uniqueId->getTerminateAt();
|
||||
|
||||
if ($terminateAt && time() > strtotime($terminateAt->getString())) {
|
||||
if ($terminateAt && time() > strtotime($terminateAt->toString())) {
|
||||
throw new Error("LeadCapture: Opt-in confirmation expired.");
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class ConfirmationSender
|
||||
$body = str_replace('{optInUrl}', $url, $body);
|
||||
$body = str_replace('{optInLink}', $linkHtml, $body);
|
||||
|
||||
$createdAt = $uniqueId->getCreatedAt()->getString();
|
||||
$createdAt = $uniqueId->getCreatedAt()->toString();
|
||||
|
||||
if ($createdAt) {
|
||||
$dateString = $this->dateTime->convertSystemDateTime($createdAt, null, $this->config->get('dateFormat'));
|
||||
|
||||
@@ -1416,11 +1416,11 @@ class Service
|
||||
}
|
||||
|
||||
if (!$entity->isNew()) {
|
||||
if ($createdAt->getTimestamp() < $notificationThreshold->getTimestamp()) {
|
||||
if ($createdAt->toTimestamp() < $notificationThreshold->getTimestamp()) {
|
||||
$forceProcessNoteNotifications = false;
|
||||
}
|
||||
|
||||
if ($createdAt->getTimestamp() < $aclThreshold->getTimestamp()) {
|
||||
if ($createdAt->toTimestamp() < $aclThreshold->getTimestamp()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ class RecoveryService
|
||||
->setTime(
|
||||
DateTime::createNow()
|
||||
->modify('+' . $lifetime)
|
||||
->getDateTime()
|
||||
->toDateTime()
|
||||
)
|
||||
->setQueue(QueueName::Q1)
|
||||
->schedule();
|
||||
@@ -555,7 +555,7 @@ class RecoveryService
|
||||
return;
|
||||
}
|
||||
|
||||
$data->set('lastPasswordRecoveryDate', DateTime::createNow()->getString());
|
||||
$data->set('lastPasswordRecoveryDate', DateTime::createNow()->toString());
|
||||
|
||||
$this->entityManager->saveEntity($data);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ class Extractor
|
||||
{
|
||||
$pointer = $from->withTimezone($calendar->getTimezone());
|
||||
|
||||
$fromDate = Date::fromDateTime($from->modify('-1 day')->getDateTime());
|
||||
$toDate = Date::fromDateTime($from->modify('+1 day')->getDateTime());
|
||||
$fromDate = Date::fromDateTime($from->modify('-1 day')->toDateTime());
|
||||
$toDate = Date::fromDateTime($from->modify('+1 day')->toDateTime());
|
||||
|
||||
$workingDates = $calendar->getWorkingDates($fromDate, $toDate);
|
||||
$nonWorkingDates = $calendar->getNonWorkingDates($fromDate, $toDate);
|
||||
@@ -56,7 +56,7 @@ class Extractor
|
||||
|
||||
$end = $to->withTimezone($calendar->getTimezone())->withTime(23, 59, 59);
|
||||
|
||||
while ($pointer->getTimestamp() < $end->getTimestamp()) {
|
||||
while ($pointer->toTimestamp() < $end->toTimestamp()) {
|
||||
$list = array_merge(
|
||||
$list,
|
||||
$this->extractIteration(
|
||||
@@ -143,8 +143,8 @@ class Extractor
|
||||
->withTimezone($calendar->getTimezone())
|
||||
->withTime(0, 0, 0);
|
||||
|
||||
$fromDate = Date::fromDateTime($from->modify('-1 day')->getDateTime());
|
||||
$toDate = Date::fromDateTime($from->modify('+1 day')->getDateTime());
|
||||
$fromDate = Date::fromDateTime($from->modify('-1 day')->toDateTime());
|
||||
$toDate = Date::fromDateTime($from->modify('+1 day')->toDateTime());
|
||||
|
||||
$workingDates = $calendar->getWorkingDates($fromDate, $toDate);
|
||||
$nonWorkingDates = $calendar->getNonWorkingDates($fromDate, $toDate);
|
||||
@@ -154,7 +154,7 @@ class Extractor
|
||||
|
||||
$end = $to->withTimezone($calendar->getTimezone())->withTime(23, 59, 59);
|
||||
|
||||
while ($pointer->getTimestamp() < $end->getTimestamp()) {
|
||||
while ($pointer->toTimestamp() < $end->toTimestamp()) {
|
||||
$isWorkingDay = $this->isWorkingDay(
|
||||
$pointer,
|
||||
$workingDates,
|
||||
@@ -370,7 +370,7 @@ class Extractor
|
||||
*/
|
||||
private function extractFromDay(DateTime $dateTime, HavingRanges $day): array
|
||||
{
|
||||
$pointer = $dateTime->getDateTime();
|
||||
$pointer = $dateTime->toDateTime();
|
||||
|
||||
$list = [];
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ class GlobalCalendar implements Calendar
|
||||
*/
|
||||
private function getDates(Date $from, Date $to): array
|
||||
{
|
||||
$cacheKey = $from->getString() . '-' . $to->getString();
|
||||
$cacheKey = $from->toString() . '-' . $to->toString();
|
||||
|
||||
if ($this->cacheKey === $cacheKey) {
|
||||
assert($this->cache !== null);
|
||||
@@ -207,11 +207,11 @@ class GlobalCalendar implements Calendar
|
||||
OrGroup::create(
|
||||
Condition::greaterOrEqual(
|
||||
Expression::column('dateEnd'),
|
||||
$from->getString()
|
||||
$from->toString()
|
||||
),
|
||||
Condition::lessOrEqual(
|
||||
Expression::column('dateStart'),
|
||||
$to->getString()
|
||||
$to->toString()
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -160,7 +160,7 @@ class TeamCalendar implements Calendar
|
||||
*/
|
||||
private function getDates(Date $from, Date $to): array
|
||||
{
|
||||
$cacheKey = $from->getString() . '-' . $to->getString();
|
||||
$cacheKey = $from->toString() . '-' . $to->toString();
|
||||
|
||||
if ($this->cacheKey === $cacheKey) {
|
||||
assert($this->cache !== null);
|
||||
@@ -228,11 +228,11 @@ class TeamCalendar implements Calendar
|
||||
OrGroup::create(
|
||||
Condition::greaterOrEqual(
|
||||
Expression::column('dateEnd'),
|
||||
$from->getString()
|
||||
$from->toString()
|
||||
),
|
||||
Condition::lessOrEqual(
|
||||
Expression::column('dateStart'),
|
||||
$to->getString()
|
||||
$to->toString()
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -183,7 +183,7 @@ class UserCalendar implements Calendar
|
||||
*/
|
||||
private function getDates(Date $from, Date $to): array
|
||||
{
|
||||
$cacheKey = $from->getString() . '-' . $to->getString();
|
||||
$cacheKey = $from->toString() . '-' . $to->toString();
|
||||
|
||||
if ($this->cacheKey === $cacheKey) {
|
||||
assert($this->cache !== null);
|
||||
@@ -219,7 +219,7 @@ class UserCalendar implements Calendar
|
||||
$dates = array_filter(
|
||||
$this->rangeToDates($range),
|
||||
function (WorkingDate $date) use ($metMap) {
|
||||
return !array_key_exists($date->getDate()->getString(), $metMap);
|
||||
return !array_key_exists($date->getDate()->toString(), $metMap);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -271,11 +271,11 @@ class UserCalendar implements Calendar
|
||||
OrGroup::create(
|
||||
Condition::greaterOrEqual(
|
||||
Expression::column('dateEnd'),
|
||||
$from->getString()
|
||||
$from->toString()
|
||||
),
|
||||
Condition::lessOrEqual(
|
||||
Expression::column('dateStart'),
|
||||
$to->getString()
|
||||
$to->toString()
|
||||
),
|
||||
)
|
||||
)
|
||||
@@ -312,11 +312,11 @@ class UserCalendar implements Calendar
|
||||
OrGroup::create(
|
||||
Condition::greaterOrEqual(
|
||||
Expression::column('dateEnd'),
|
||||
$from->getString()
|
||||
$from->toString()
|
||||
),
|
||||
Condition::lessOrEqual(
|
||||
Expression::column('dateStart'),
|
||||
$to->getString()
|
||||
$to->toString()
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -841,32 +841,32 @@ class FormulaTest extends BaseTestCase
|
||||
$script = sprintf(
|
||||
"ext\\calendar\\userIsBusy('%s', '%s', '%s')",
|
||||
$user->getId(),
|
||||
$dateStart->getString(),
|
||||
$dateEnd->getString()
|
||||
$dateStart->toString(),
|
||||
$dateEnd->toString()
|
||||
);
|
||||
$this->assertTrue($fm->run($script));
|
||||
|
||||
$script = sprintf(
|
||||
"ext\\calendar\\userIsBusy('%s', '%s', '%s')",
|
||||
$user->getId(),
|
||||
$dateStart->addHours(-1)->getString(),
|
||||
$dateEnd->addHours(1)->getString()
|
||||
$dateStart->addHours(-1)->toString(),
|
||||
$dateEnd->addHours(1)->toString()
|
||||
);
|
||||
$this->assertTrue($fm->run($script));
|
||||
|
||||
$script = sprintf(
|
||||
"ext\\calendar\\userIsBusy('%s', '%s', '%s')",
|
||||
$user->getId(),
|
||||
$dateStart->addDays(-1)->getString(),
|
||||
$dateEnd->addDays(-1)->getString()
|
||||
$dateStart->addDays(-1)->toString(),
|
||||
$dateEnd->addDays(-1)->toString()
|
||||
);
|
||||
$this->assertFalse($fm->run($script));
|
||||
|
||||
$script = sprintf(
|
||||
"ext\\calendar\\userIsBusy('%s', '%s', '%s', '%s', '%s')",
|
||||
$user->getId(),
|
||||
$dateStart->getString(),
|
||||
$dateEnd->getString(),
|
||||
$dateStart->toString(),
|
||||
$dateEnd->toString(),
|
||||
$meeting->getEntityType(),
|
||||
$meeting->getId()
|
||||
);
|
||||
|
||||
@@ -129,7 +129,7 @@ class LinkTest extends BaseTestCase
|
||||
'amount' => 1.0,
|
||||
'amountCurrency' => 'USD',
|
||||
'probability' => 10,
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
], CreateParams::create());
|
||||
|
||||
$isThrown = false;
|
||||
@@ -143,7 +143,7 @@ class LinkTest extends BaseTestCase
|
||||
'amount' => 1.0,
|
||||
'amountCurrency' => 'USD',
|
||||
'probability' => 10,
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
], CreateParams::create());
|
||||
}
|
||||
catch (Forbidden) {
|
||||
@@ -229,7 +229,7 @@ class LinkTest extends BaseTestCase
|
||||
'amount' => 1.0,
|
||||
'amountCurrency' => 'USD',
|
||||
'probability' => 10,
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
], CreateParams::create());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ class AclTest extends \tests\integration\Core\BaseTestCase
|
||||
'probability' => 10,
|
||||
'amount' => 1,
|
||||
'contactsIds' => [],
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
'assignedUserId' => $userId,
|
||||
], CreateParams::create());
|
||||
|
||||
@@ -633,7 +633,7 @@ class AclTest extends \tests\integration\Core\BaseTestCase
|
||||
'amount' => 1,
|
||||
'probability' => 10,
|
||||
'contactsIds' => [$contact1->getId()],
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
'assignedUserId' => $userId,
|
||||
], CreateParams::create());
|
||||
|
||||
@@ -669,7 +669,7 @@ class AclTest extends \tests\integration\Core\BaseTestCase
|
||||
'amount' => 1,
|
||||
'probability' => 10,
|
||||
'contactsIds' => [$contact2->getId()],
|
||||
'closeDate' => Date::createToday()->getString(),
|
||||
'closeDate' => Date::createToday()->toString(),
|
||||
'assignedUserId' => $userId,
|
||||
], CreateParams::create());
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = Date::fromString('2021-05-01');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getString());
|
||||
$this->assertEquals('2021-05-01', $value->toString());
|
||||
}
|
||||
|
||||
public function testFromDateTime()
|
||||
@@ -53,7 +53,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = Date::fromDateTime($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getString());
|
||||
$this->assertEquals('2021-05-01', $value->toString());
|
||||
}
|
||||
|
||||
public function testBad1()
|
||||
@@ -81,7 +81,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = Date::fromString('2021-05-01');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getDateTime()->format('Y-m-d'));
|
||||
$this->assertEquals('2021-05-01', $value->toDateTime()->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testGetMethods()
|
||||
@@ -95,7 +95,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals(2021, $value->getYear());
|
||||
$this->assertEquals(6, $value->getDayOfWeek());
|
||||
|
||||
$this->assertEquals($dt->getTimestamp(), $value->getTimestamp());
|
||||
$this->assertEquals($dt->getTimestamp(), $value->toTimestamp());
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
@@ -104,7 +104,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->add(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-05-02', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-05-02', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->subtract(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-04-30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-04-30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class DateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->modify('+1 month');
|
||||
|
||||
$this->assertEquals('2021-06-01', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-06-01', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTime::fromString('2021-05-01 10:20:30');
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
}
|
||||
|
||||
public function testFromString2()
|
||||
{
|
||||
$value = DateTime::fromString('2021-05-01 10:20');
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:00', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:00', $value->toString());
|
||||
}
|
||||
|
||||
public function testFromDateTime1()
|
||||
@@ -58,7 +58,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTime::fromDateTime($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
}
|
||||
|
||||
public function testFromDateTime2()
|
||||
@@ -67,7 +67,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTime::fromDateTime($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01 07:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 07:20:30', $value->toString());
|
||||
}
|
||||
|
||||
public function testBad1()
|
||||
@@ -95,7 +95,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTime::fromString('2021-05-01 10:20:30');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getDateTime()->format('Y-m-d'));
|
||||
$this->assertEquals('2021-05-01', $value->toDateTime()->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testGetMethods()
|
||||
@@ -112,7 +112,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals(20, $value->getMinute());
|
||||
$this->assertEquals(30, $value->getSecond());
|
||||
|
||||
$this->assertEquals($dt->getTimestamp(), $value->getTimestamp());
|
||||
$this->assertEquals($dt->getTimestamp(), $value->toTimestamp());
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
@@ -121,7 +121,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->add(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-05-02 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-05-02 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->subtract(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-04-30 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-04-30 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -143,7 +143,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->modify('+1 month');
|
||||
|
||||
$this->assertEquals('2021-06-01 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-06-01 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
::fromString('2021-05-01 10:20:30')
|
||||
->withTimezone(new DateTimeZone('Europe/Kiev'));
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
|
||||
$this->assertEquals(13, $value->getHour());
|
||||
}
|
||||
@@ -190,22 +190,22 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:00',
|
||||
$value->withTime(0, 0, 0)->getString()
|
||||
$value->withTime(0, 0, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:10:30',
|
||||
$value->withTime(0, null, null)->getString()
|
||||
$value->withTime(0, null, null)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 10:00:00',
|
||||
$value->withTime(null, 0)->getString()
|
||||
$value->withTime(null, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 10:00:10',
|
||||
$value->withTime(null, 0, 10)->getString()
|
||||
$value->withTime(null, 0, 10)->toString()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ class DateTimeTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTime::fromTimestamp($timestamp);
|
||||
|
||||
$this->assertEquals($timestamp, $value->getTimestamp());
|
||||
$this->assertEquals($timestamp, $value->toTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getString());
|
||||
$this->assertEquals('2021-05-01', $value->toString());
|
||||
|
||||
$this->assertTrue($value->isAllDay());
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTimeOptional::fromDateTimeAllDay($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getString());
|
||||
$this->assertEquals('2021-05-01', $value->toString());
|
||||
}
|
||||
|
||||
public function testBad1()
|
||||
@@ -83,14 +83,14 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getDateTime()->format('Y-m-d'));
|
||||
$this->assertEquals('2021-05-01', $value->toDateTime()->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testGetTimezone()
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01');
|
||||
|
||||
$this->assertEquals(new DateTimeZone('UTC'), $value->getDateTime()->getTimezone());
|
||||
$this->assertEquals(new DateTimeZone('UTC'), $value->toDateTime()->getTimezone());
|
||||
}
|
||||
|
||||
public function testGetMethods()
|
||||
@@ -104,7 +104,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals(2021, $value->getYear());
|
||||
$this->assertEquals(6, $value->getDayOfWeek());
|
||||
|
||||
$this->assertEquals($dt->getTimestamp(), $value->getTimestamp());
|
||||
$this->assertEquals($dt->getTimestamp(), $value->toTimestamp());
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
@@ -113,7 +113,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->add(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-05-02', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-05-02', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->subtract(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-04-30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-04-30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->modify('+1 month');
|
||||
|
||||
$this->assertEquals('2021-06-01', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-06-01', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ class DateTimeOptionalDateTest extends \PHPUnit\Framework\TestCase
|
||||
::fromString('2021-05-01')
|
||||
->withTimezone(new DateTimeZone('Europe/Kiev'));
|
||||
|
||||
$this->assertEquals('2021-05-01 00:00:00', $value->getString());
|
||||
$this->assertEquals('2021-05-01 00:00:00', $value->toString());
|
||||
|
||||
$this->assertEquals(new DateTimeZone('Europe/Kiev'), $value->getTimezone());
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01 10:20:30');
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
|
||||
$this->assertFalse($value->isAllDay());
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01 10:20');
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:00', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:00', $value->toString());
|
||||
|
||||
$this->assertFalse($value->isAllDay());
|
||||
}
|
||||
@@ -64,7 +64,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTimeOptional::fromDateTime($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
}
|
||||
|
||||
public function testFromDateTime2()
|
||||
@@ -73,7 +73,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = DateTimeOptional::fromDateTime($dt);
|
||||
|
||||
$this->assertEquals('2021-05-01 07:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 07:20:30', $value->toString());
|
||||
}
|
||||
|
||||
public function testBad1()
|
||||
@@ -101,7 +101,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
$value = DateTimeOptional::fromString('2021-05-01 10:20:30');
|
||||
|
||||
$this->assertEquals('2021-05-01', $value->getDateTime()->format('Y-m-d'));
|
||||
$this->assertEquals('2021-05-01', $value->toDateTime()->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testGetMethods()
|
||||
@@ -127,7 +127,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->add(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-05-02 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-05-02 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->subtract(DateInterval::createFromDateString('1 day'));
|
||||
|
||||
$this->assertEquals('2021-04-30 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-04-30 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$modifiedValue = $value->modify('+1 month');
|
||||
|
||||
$this->assertEquals('2021-06-01 10:20:30', $modifiedValue->getString());
|
||||
$this->assertEquals('2021-06-01 10:20:30', $modifiedValue->toString());
|
||||
|
||||
$this->assertNotSame($modifiedValue, $value);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
::fromString('2021-05-01 10:20:30')
|
||||
->withTimezone(new DateTimeZone('Europe/Kiev'));
|
||||
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->getString());
|
||||
$this->assertEquals('2021-05-01 10:20:30', $value->toString());
|
||||
|
||||
$this->assertEquals(13, $value->getHour());
|
||||
}
|
||||
@@ -197,22 +197,22 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:00',
|
||||
$value->withTime(0, 0, 0)->getString()
|
||||
$value->withTime(0, 0, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:10:30',
|
||||
$value->withTime(0, null, null)->getString()
|
||||
$value->withTime(0, null, null)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 10:00:00',
|
||||
$value->withTime(null, 0)->getString()
|
||||
$value->withTime(null, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 10:00:10',
|
||||
$value->withTime(null, 0, 10)->getString()
|
||||
$value->withTime(null, 0, 10)->toString()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -222,22 +222,22 @@ class DateTimeOptionalTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:00',
|
||||
$value->withTime(0, 0, 0)->getString()
|
||||
$value->withTime(0, 0, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:00',
|
||||
$value->withTime(0, null, null)->getString()
|
||||
$value->withTime(0, null, null)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:00',
|
||||
$value->withTime(null, 0)->getString()
|
||||
$value->withTime(null, 0)->toString()
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'2021-05-01 00:00:10',
|
||||
$value->withTime(null, 0, 10)->getString()
|
||||
$value->withTime(null, 0, 10)->toString()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class FetchDataTest extends \PHPUnit\Framework\TestCase
|
||||
$data = FetchData::fromRaw($raw);
|
||||
|
||||
$this->assertEquals('10', $data->getLastUniqueId('test'));
|
||||
$this->assertEquals('2022-01-01 00:00:00', $data->getLastDate('test')->getString());
|
||||
$this->assertEquals('2022-01-01 00:00:00', $data->getLastDate('test')->toString());
|
||||
$this->assertEquals(null, $data->getLastUniqueId('not-existing'));
|
||||
$this->assertEquals(null, $data->getLastDate('not-existing'));
|
||||
$this->assertEquals(false, $data->getForceByDate('test'));
|
||||
|
||||
Reference in New Issue
Block a user