Conditions | 2 |
Paths | 1 |
Total Lines | 8 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
35 | 2 | public function persistTimestampedFields(object $timestamped, bool $isNew): void |
|
36 | { |
||
37 | 2 | $configuration = $this->annotationReader->getConfiguration($timestamped); |
|
38 | 2 | $classMetadata = $this->getClassMetadata($timestamped); |
|
39 | 2 | $classMetadata->setFieldValue($timestamped, $configuration->createdAtField, $isNew ? |
|
40 | 2 | new \DateTimeImmutable() : |
|
41 | 2 | $classMetadata->getFieldValue($timestamped, $configuration->createdAtField)); |
|
42 | 2 | $classMetadata->setFieldValue($timestamped, $configuration->modifiedAtField, new \DateTime()); |
|
43 | 2 | } |
|
45 |