{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/Entity\/EntityTaxonomyMapping.php",
"old_string": " if (isset($data['updated_at']) && $data['updated_at'] !== null) {\n $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));\n }",
"new_string": " if (isset($data['updated_at'])) {\n $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));\n }"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/Entity\/EntityTaxonomyMapping.php",
"oldString": " if (isset($data['updated_at']) && $data['updated_at'] !== null) {\n $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));\n }",
"newString": " if (isset($data['updated_at'])) {\n $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));\n }",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\Entity;\n\n\/\/ @responsibility: Mapping zwischen Entity und Taxonomie-Begriff\n\nuse Domain\\ValueObject\\Confidence;\n\nclass EntityTaxonomyMapping\n{\n private ?int $id = null;\n private int $entityId;\n private int $taxonomyTermId;\n private Confidence $relevance;\n private bool $validated = false;\n private \\DateTimeImmutable $createdAt;\n private ?\\DateTimeImmutable $updatedAt = null;\n\n public function __construct()\n {\n $this->createdAt = new \\DateTimeImmutable();\n $this->relevance = Confidence::medium();\n }\n\n \/\/ Getters\n public function getId(): ?int\n {\n return $this->id;\n }\n\n public function getEntityId(): int\n {\n return $this->entityId;\n }\n\n public function getTaxonomyTermId(): int\n {\n return $this->taxonomyTermId;\n }\n\n public function getRelevance(): Confidence\n {\n return $this->relevance;\n }\n\n public function isValidated(): bool\n {\n return $this->validated;\n }\n\n public function getCreatedAt(): \\DateTimeImmutable\n {\n return $this->createdAt;\n }\n\n public function getUpdatedAt(): ?\\DateTimeImmutable\n {\n return $this->updatedAt;\n }\n\n \/\/ Setters\n public function setId(int $id): self\n {\n $this->id = $id;\n\n return $this;\n }\n\n public function setEntityId(int $entityId): self\n {\n $this->entityId = $entityId;\n\n return $this;\n }\n\n public function setTaxonomyTermId(int $taxonomyTermId): self\n {\n $this->taxonomyTermId = $taxonomyTermId;\n\n return $this;\n }\n\n public function setRelevance(Confidence $relevance): self\n {\n $this->relevance = $relevance;\n $this->touch();\n\n return $this;\n }\n\n public function setRelevanceFromFloat(float $value): self\n {\n $this->relevance = Confidence::fromFloat($value);\n $this->touch();\n\n return $this;\n }\n\n public function setValidated(bool $validated): self\n {\n $this->validated = $validated;\n $this->touch();\n\n return $this;\n }\n\n public function setCreatedAt(\\DateTimeImmutable $createdAt): self\n {\n $this->createdAt = $createdAt;\n\n return $this;\n }\n\n public function setUpdatedAt(?\\DateTimeImmutable $updatedAt): self\n {\n $this->updatedAt = $updatedAt;\n\n return $this;\n }\n\n \/\/ Domain Methods\n public function validate(): self\n {\n $this->validated = true;\n $this->touch();\n\n return $this;\n }\n\n public function invalidate(): self\n {\n $this->validated = false;\n $this->touch();\n\n return $this;\n }\n\n private function touch(): void\n {\n $this->updatedAt = new \\DateTimeImmutable();\n }\n\n public function toArray(): array\n {\n return [\n 'id' => $this->id,\n 'entity_id' => $this->entityId,\n 'taxonomy_term_id' => $this->taxonomyTermId,\n 'relevance' => $this->relevance->value(),\n 'validated' => $this->validated ? 1 : 0,\n 'created_at' => $this->createdAt->format('Y-m-d H:i:s'),\n 'updated_at' => $this->updatedAt?->format('Y-m-d H:i:s'),\n ];\n }\n\n public static function fromArray(array $data): self\n {\n $mapping = new self();\n\n if (isset($data['id'])) {\n $mapping->setId((int) $data['id']);\n }\n if (isset($data['entity_id'])) {\n $mapping->setEntityId((int) $data['entity_id']);\n }\n if (isset($data['taxonomy_term_id'])) {\n $mapping->setTaxonomyTermId((int) $data['taxonomy_term_id']);\n }\n if (isset($data['relevance'])) {\n $mapping->relevance = Confidence::fromFloat((float) $data['relevance']);\n }\n if (isset($data['validated'])) {\n $mapping->validated = (bool) $data['validated'];\n }\n if (isset($data['created_at'])) {\n $mapping->setCreatedAt(new \\DateTimeImmutable($data['created_at']));\n }\n if (isset($data['updated_at']) && $data['updated_at'] !== null) {\n $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));\n }\n\n return $mapping;\n }\n}\n",
"structuredPatch": [
{
"oldStart": 177,
"oldLines": 7,
"newStart": 177,
"newLines": 7,
"lines": [
" if (isset($data['created_at'])) {",
" $mapping->setCreatedAt(new \\DateTimeImmutable($data['created_at']));",
" }",
"- if (isset($data['updated_at']) && $data['updated_at'] !== null) {",
"+ if (isset($data['updated_at'])) {",
" $mapping->setUpdatedAt(new \\DateTimeImmutable($data['updated_at']));",
" }",
" "
]
}
],
"userModified": false,
"replaceAll": false
}
}