]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Country.php
Version 0.6.1
[airbundle] / Entity / Country.php
index 48a3037d7639c6063484b6fbbfd4b6c074b47de0..b6b43918762c7f48af66766ffb878b7617ab075b 100644 (file)
@@ -27,12 +27,12 @@ class Country {
        /**
         * Create datetime
         */
-       private \DateTime $created;
+       private \DateTimeImmutable $created;
 
        /**
         * Update datetime
         */
-       private \DateTime $updated;
+       private \DateTimeImmutable $updated;
 
        /**
         * Users collection
@@ -48,8 +48,8 @@ class Country {
         */
        public function __construct(private string $code, private string $alpha, 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->users = new ArrayCollection();
@@ -133,11 +133,11 @@ class Country {
        /**
         * Set created
         *
-        * @param \DateTime $created
+        * @param \DateTimeImmutable $created
         *
         * @return Country
         */
-       public function setCreated(\DateTime $created): Country {
+       public function setCreated(\DateTimeImmutable $created): Country {
                $this->created = $created;
 
                return $this;
@@ -146,20 +146,20 @@ class Country {
        /**
         * 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 Country
         */
-       public function setUpdated(\DateTime $updated): Country {
+       public function setUpdated(\DateTimeImmutable $updated): Country {
                $this->updated = $updated;
 
                return $this;
@@ -168,9 +168,9 @@ class Country {
        /**
         * Get updated
         *
-        * @return \DateTime
+        * @return \DateTimeImmutable
         */
-       public function getUpdated(): \DateTime {
+       public function getUpdated(): \DateTimeImmutable {
                return $this->updated;
        }
 
@@ -212,7 +212,7 @@ class Country {
                //Check that we have an country instance
                if (($country = $eventArgs->getObject()) instanceof Country) {
                        //Set updated value
-                       $country->setUpdated(new \DateTime('now'));
+                       $country->setUpdated(new \DateTimeImmutable('now'));
                }
        }