]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Slot.php
Version 0.6.1
[airbundle] / Entity / Slot.php
index 25ef3e8427e642693c058eba7b2cd75d1575f7cf..1977b93791977dad4fe7f468a64cd8d77eff4930 100644 (file)
@@ -27,12 +27,12 @@ class Slot {
        /**
         * Create datetime
         */
-       private \DateTime $created;
+       private \DateTimeImmutable $created;
 
        /**
         * Update datetime
         */
-       private \DateTime $updated;
+       private \DateTimeImmutable $updated;
 
        /**
         * Sessions collection
@@ -44,8 +44,8 @@ class Slot {
         */
        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();
@@ -85,11 +85,11 @@ class Slot {
        /**
         * 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;
@@ -98,20 +98,20 @@ class Slot {
        /**
         * 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;
@@ -120,9 +120,9 @@ class Slot {
        /**
         * Get updated
         *
-        * @return \DateTime
+        * @return \DateTimeImmutable
         */
-       public function getUpdated(): \DateTime {
+       public function getUpdated(): \DateTimeImmutable {
                return $this->updated;
        }
 
@@ -164,7 +164,7 @@ class Slot {
                //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'));
                }
        }