mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 23:04:58 +00:00
Do not use DateTimeImmutable.
This commit is contained in:
@@ -25,7 +25,6 @@ namespace Chill\PersonBundle\Entity;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* AccompanyingPeriod
|
||||
@@ -35,9 +34,11 @@ class AccompanyingPeriod
|
||||
/** @var integer */
|
||||
private $id;
|
||||
|
||||
private DateTimeImmutable $openingDate;
|
||||
/** @var \DateTime */
|
||||
private $openingDate;
|
||||
|
||||
private ?DateTimeImmutable $closingDate = null;
|
||||
/** @var \DateTime */
|
||||
private $closingDate;
|
||||
|
||||
/** @var string */
|
||||
private $remark = '';
|
||||
@@ -56,11 +57,11 @@ class AccompanyingPeriod
|
||||
private $user;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \DateTimeImmutable $dateOpening
|
||||
*
|
||||
* @param \DateTime $dateOpening
|
||||
* @uses AccompanyingPeriod::setClosingDate()
|
||||
*/
|
||||
public function __construct(\DateTimeImmutable $dateOpening) {
|
||||
public function __construct(\DateTime $dateOpening) {
|
||||
$this->setOpeningDate($dateOpening);
|
||||
}
|
||||
|
||||
@@ -74,14 +75,25 @@ class AccompanyingPeriod
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setOpeningDate(DateTimeImmutable $openingDate): self
|
||||
/**
|
||||
* Set openingDate
|
||||
*
|
||||
* @param \DateTime $dateOpening
|
||||
* @return AccompanyingPeriod
|
||||
*/
|
||||
public function setOpeningDate($openingDate)
|
||||
{
|
||||
$this->openingDate = $openingDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getOpeningDate(): DateTimeImmutable
|
||||
/**
|
||||
* Get openingDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getOpeningDate()
|
||||
{
|
||||
return $this->openingDate;
|
||||
}
|
||||
@@ -91,14 +103,19 @@ class AccompanyingPeriod
|
||||
*
|
||||
* For closing a Person file, you should use Person::setClosed instead.
|
||||
*/
|
||||
public function setClosingDate(DateTimeImmutable $closingDate): self
|
||||
public function setClosingDate($closingDate)
|
||||
{
|
||||
$this->closingDate = $closingDate;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClosingDate(): ?DateTimeImmutable
|
||||
/**
|
||||
* Get closingDate
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getClosingDate()
|
||||
{
|
||||
return $this->closingDate;
|
||||
}
|
||||
@@ -109,7 +126,7 @@ class AccompanyingPeriod
|
||||
*/
|
||||
public function isOpen(): bool
|
||||
{
|
||||
if ($this->getOpeningDate() > new \DateTimeImmutable('now')) {
|
||||
if ($this->getOpeningDate() > new \DateTime('now')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user