/**
* Create datetime
*/
- private \DateTime $created;
+ private \DateTimeImmutable $created;
/**
* Update datetime
*/
- private \DateTime $updated;
+ private \DateTimeImmutable $updated;
/**
* Sessions collection
*/
public function __construct(private string $title) {
//Set defaults
- $this->created = new \DateTime('now');
- $this->updated = new \DateTime('now');
+ $this->created = new \DateTimeImmutable('now');
+ $this->updated = new \DateTimeImmutable('now');
//Set collections
$this->sessions = new ArrayCollection();
/**
* Set created
*
- * @param \DateTime $created
+ * @param \DateTimeImmutable $created
*
* @return Slot
*/
- public function setCreated(\DateTime $created) {
+ public function setCreated(\DateTimeImmutable $created) {
$this->created = $created;
return $this;
/**
* Get created
*
- * @return \DateTime
+ * @return \DateTimeImmutable
*/
- public function getCreated(): \DateTime {
+ public function getCreated(): \DateTimeImmutable {
return $this->created;
}
/**
* Set updated
*
- * @param \DateTime $updated
+ * @param \DateTimeImmutable $updated
*
* @return Slot
*/
- public function setUpdated(\DateTime $updated) {
+ public function setUpdated(\DateTimeImmutable $updated) {
$this->updated = $updated;
return $this;
/**
* Get updated
*
- * @return \DateTime
+ * @return \DateTimeImmutable
*/
- public function getUpdated(): \DateTime {
+ public function getUpdated(): \DateTimeImmutable {
return $this->updated;
}
//Check that we have a slot instance
if (($slot = $eventArgs->getObject()) instanceof Slot) {
//Set updated value
- $slot->setUpdated(new \DateTime('now'));
+ $slot->setUpdated(new \DateTimeImmutable('now'));
}
}