11<?php
22
3- declare (strict_types=1 );
4-
53/*
64 * This file is part of the ixnode/php-api-version-bundle project.
75 *
119 * file that was distributed with this source code.
1210 */
1311
12+ declare (strict_types=1 );
13+
1414namespace Ixnode \PhpApiVersionBundle \Entity \Trait ;
1515
1616use DateTimeImmutable ;
1717use Doctrine \ORM \Mapping as ORM ;
18+ use Symfony \Component \Serializer \Annotation \Ignore ;
1819
1920/**
20- * Trait TimestampsTrait
21+ * Trait TimestampTrait
2122 *
2223 * @author Björn Hempel <bjoern@hempel.li>
2324 * @version 0.1.0 (2023-01-01)
2627trait TimestampsTrait
2728{
2829 #[ORM \Column(name: 'created_at ' , type: 'datetime_immutable ' )]
30+ #[Ignore]
2931 private ?DateTimeImmutable $ createdAt = null ;
3032
3133 #[ORM \Column(name: 'updated_at ' , type: 'datetime_immutable ' )]
34+ #[Ignore]
3235 private ?DateTimeImmutable $ updatedAt = null ;
3336
3437 /**
35- * Gets the created at field of this trait.
36- *
3738 * @return DateTimeImmutable|null
3839 */
3940 public function getCreatedAt (): ?DateTimeImmutable
@@ -42,21 +43,17 @@ public function getCreatedAt(): ?DateTimeImmutable
4243 }
4344
4445 /**
45- * Sets the created at field of this trait.
46- *
47- * @param DateTimeImmutable $timestamp
46+ * @param DateTimeImmutable $createdAt
4847 * @return $this
4948 */
50- public function setCreatedAt (DateTimeImmutable $ timestamp ): self
49+ public function setCreatedAt (DateTimeImmutable $ createdAt ): self
5150 {
52- $ this ->createdAt = $ timestamp ;
51+ $ this ->createdAt = $ createdAt ;
5352
5453 return $ this ;
5554 }
5655
5756 /**
58- * Gets the updated at field of this trait.
59- *
6057 * @return DateTimeImmutable|null
6158 */
6259 public function getUpdatedAt (): ?DateTimeImmutable
@@ -65,14 +62,12 @@ public function getUpdatedAt(): ?DateTimeImmutable
6562 }
6663
6764 /**
68- * Sets the updated at field of this trait.
69- *
70- * @param DateTimeImmutable $timestamp
65+ * @param DateTimeImmutable $updatedAt
7166 * @return $this
7267 */
73- public function setUpdatedAt (DateTimeImmutable $ timestamp ): self
68+ public function setUpdatedAt (DateTimeImmutable $ updatedAt ): self
7469 {
75- $ this ->updatedAt = $ timestamp ;
70+ $ this ->updatedAt = $ updatedAt ;
7671
7772 return $ this ;
7873 }
@@ -81,6 +76,7 @@ public function setUpdatedAt(DateTimeImmutable $timestamp): self
8176 * Sets automatically the created at field.
8277 */
8378 #[ORM \PrePersist]
79+ #[Ignore]
8480 public function setCreatedAtAutomatically (): void
8581 {
8682 if ($ this ->createdAt === null ) {
@@ -93,6 +89,7 @@ public function setCreatedAtAutomatically(): void
9389 */
9490 #[ORM \PrePersist]
9591 #[ORM \PreUpdate]
92+ #[Ignore]
9693 public function setUpdatedAtAutomatically (): void
9794 {
9895 $ this ->setUpdatedAt (new DateTimeImmutable ());
0 commit comments