]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Location.php
Version 0.6.1
[airbundle] / Entity / Location.php
index d70bddf5694320a19d487fbe55d465fd9756d7e7..db76b03d73ce5da1bb2720c77346693c0bf81b5b 100644 (file)
@@ -32,12 +32,12 @@ class Location {
        /**
         * Create datetime
         */
        /**
         * Create datetime
         */
-       private \DateTime $created;
+       private \DateTimeImmutable $created;
 
        /**
         * Update datetime
         */
 
        /**
         * Update datetime
         */
-       private \DateTime $updated;
+       private \DateTimeImmutable $updated;
 
        /**
         * Sessions collection
 
        /**
         * Sessions collection
@@ -59,8 +59,8 @@ class Location {
         */
        public function __construct(private string $title = '', private string $address = '', private string $zipcode = '0', private string $city = '', private string $latitude = '0', private string $longitude = '0', private bool $hotspot = false, private bool $indoor = false) {
                //Set defaults
         */
        public function __construct(private string $title = '', private string $address = '', private string $zipcode = '0', private string $city = '', private string $latitude = '0', private string $longitude = '0', private bool $hotspot = false, private bool $indoor = false) {
                //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 collections
                $this->sessions = new ArrayCollection();
@@ -278,11 +278,11 @@ class Location {
        /**
         * Set created
         *
        /**
         * Set created
         *
-        * @param \DateTime $created
+        * @param \DateTimeImmutable $created
         *
         * @return Location
         */
         *
         * @return Location
         */
-       public function setCreated(\DateTime $created): Location {
+       public function setCreated(\DateTimeImmutable $created): Location {
                $this->created = $created;
 
                return $this;
                $this->created = $created;
 
                return $this;
@@ -291,20 +291,20 @@ class Location {
        /**
         * Get created
         *
        /**
         * Get created
         *
-        * @return \DateTime
+        * @return \DateTimeImmutable
         */
         */
-       public function getCreated(): \DateTime {
+       public function getCreated(): \DateTimeImmutable {
                return $this->created;
        }
 
        /**
         * Set updated
         *
                return $this->created;
        }
 
        /**
         * Set updated
         *
-        * @param \DateTime $updated
+        * @param \DateTimeImmutable $updated
         *
         * @return Location
         */
         *
         * @return Location
         */
-       public function setUpdated(\DateTime $updated): Location {
+       public function setUpdated(\DateTimeImmutable $updated): Location {
                $this->updated = $updated;
 
                return $this;
                $this->updated = $updated;
 
                return $this;
@@ -313,9 +313,9 @@ class Location {
        /**
         * Get updated
         *
        /**
         * Get updated
         *
-        * @return \DateTime
+        * @return \DateTimeImmutable
         */
         */
-       public function getUpdated(): \DateTime {
+       public function getUpdated(): \DateTimeImmutable {
                return $this->updated;
        }
 
                return $this->updated;
        }
 
@@ -432,7 +432,7 @@ class Location {
                //Check that we have a location instance
                if (($location = $eventArgs->getObject()) instanceof Location) {
                        //Set updated value
                //Check that we have a location instance
                if (($location = $eventArgs->getObject()) instanceof Location) {
                        //Set updated value
-                       $location->setUpdated(new \DateTime('now'));
+                       $location->setUpdated(new \DateTimeImmutable('now'));
                }
        }
 
                }
        }