{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Domain\/Entity\/ChatSession.php",
"oldString": " \/\/ Setters with fluent interface\n public function setId(int $id): self\n {\n $this->id = $id;\n\n return $this;\n }\n\n public function setUuid(string $uuid): self\n {\n $this->uuid = SessionUuid::fromString($uuid);\n\n return $this;\n }\n\n public function setSessionToken(?string $sessionToken): self\n {\n $this->sessionToken = $sessionToken;\n\n return $this;\n }\n\n public function setUserId(?int $userId): self\n {\n $this->userId = $userId;\n\n return $this;\n }\n\n public function setPersonaId(?int $personaId): self\n {\n $this->personaId = $personaId;\n\n return $this;\n }\n\n public function setTitle(?string $title): self\n {\n $this->title = $title;\n $this->touch();\n\n return $this;\n }\n\n public function setModel(string $model): self\n {\n $this->model = $model;\n $this->touch();\n\n return $this;\n }\n\n \/**\n * @param array<string> $collections\n *\/\n public function setCollections(array $collections): self\n {\n $this->collections = $collections;\n $this->touch();\n\n return $this;\n }\n\n public function setContextLimit(int $contextLimit): self\n {\n $this->contextLimit = $contextLimit;\n $this->touch();\n\n return $this;\n }\n\n public function setTemperature(float $temperature): self\n {\n $this->temperature = $temperature;\n $this->touch();\n\n return $this;\n }\n\n public function setMaxTokens(int $maxTokens): self\n {\n $this->maxTokens = $maxTokens;\n $this->touch();\n\n return $this;\n }\n\n public function setAuthorProfileId(?int $authorProfileId): self\n {\n $this->authorProfileId = $authorProfileId;\n $this->touch();\n\n return $this;\n }\n\n public function setSystemPromptId(?int $systemPromptId): self\n {\n $this->systemPromptId = $systemPromptId;\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 public function setLastActivity(\\DateTimeImmutable $lastActivity): self\n {\n $this->lastActivity = $lastActivity;\n\n return $this;\n }\n\n \/**\n * Update timestamps on modification.\n *\/\n private function touch(): void\n {\n $this->updatedAt = new \\DateTimeImmutable();\n $this->lastActivity = new \\DateTimeImmutable();\n }\n\n \/**\n * Factory method for creating a new session.\n *\n * @param string|SessionUuid $uuid\n * @param array<string> $collections\n *\/\n public static function create(\n string|SessionUuid $uuid,\n string $model = 'claude-opus-4-5-20251101',\n array $collections = ['documents'],\n int $contextLimit = 5\n ): self {\n $session = new self();\n $session->uuid = $uuid instanceof SessionUuid ? $uuid : SessionUuid::fromString($uuid);\n $session->model = $model;\n $session->collections = $collections;\n $session->contextLimit = $contextLimit;\n\n return $session;\n }\n\n \/**\n * Create a copy with new ID (for post-save).\n *\/\n public function withId(int $id): self\n {\n $clone = clone $this;\n $clone->id = $id;\n\n return $clone;\n }\n\n \/**\n * Update settings in one call.\n *\/\n public function updateSettings(\n string $model,\n array $collections,\n int $contextLimit,\n ?int $authorProfileId,\n float $temperature,\n int $maxTokens\n ): self {\n $this->model = $model;\n $this->collections = $collections;\n $this->contextLimit = $contextLimit;\n $this->authorProfileId = $authorProfileId;\n $this->temperature = $temperature;\n $this->maxTokens = $maxTokens;\n $this->touch();\n\n return $this;\n }",
"newString": " public function withId(int $id): self\n {\n return new self(\n uuid: $this->uuid,\n metadata: $this->metadata,\n id: $id,\n sessionToken: $this->sessionToken,\n userId: $this->userId,\n personaId: $this->personaId,\n title: $this->title,\n authorProfileId: $this->authorProfileId,\n systemPromptId: $this->systemPromptId,\n createdAt: $this->createdAt,\n updatedAt: $this->updatedAt,\n lastActivity: $this->lastActivity\n );\n }\n\n public function withTitle(string $title): self\n {\n return new self(\n uuid: $this->uuid,\n metadata: $this->metadata,\n id: $this->id,\n sessionToken: $this->sessionToken,\n userId: $this->userId,\n personaId: $this->personaId,\n title: $title,\n authorProfileId: $this->authorProfileId,\n systemPromptId: $this->systemPromptId,\n createdAt: $this->createdAt,\n updatedAt: new \\DateTimeImmutable(),\n lastActivity: new \\DateTimeImmutable()\n );\n }\n\n public function updateSettings(\n string $model,\n array $collections,\n int $contextLimit,\n ?int $authorProfileId,\n float $temperature,\n int $maxTokens\n ): self {\n $newMetadata = SessionMetadata::create(\n model: $model,\n collections: $collections,\n contextLimit: $contextLimit,\n temperature: $temperature,\n maxTokens: $maxTokens\n );\n\n return new self(\n uuid: $this->uuid,\n metadata: $newMetadata,\n id: $this->id,\n sessionToken: $this->sessionToken,\n userId: $this->userId,\n personaId: $this->personaId,\n title: $this->title,\n authorProfileId: $authorProfileId,\n systemPromptId: $this->systemPromptId,\n createdAt: $this->createdAt,\n updatedAt: new \\DateTimeImmutable(),\n lastActivity: new \\DateTimeImmutable()\n );\n }",
"originalFile": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Domain\\Entity;\n\n\/\/ @responsibility: Repräsentiert eine Chat-Session mit ihren Metadaten\n\nuse Domain\\ValueObject\\SessionMetadata;\nuse Domain\\ValueObject\\SessionUuid;\n\nclass ChatSession\n{\n public function __construct(\n private SessionUuid $uuid,\n private SessionMetadata $metadata,\n private ?int $id = null,\n private ?string $sessionToken = null,\n private ?int $userId = null,\n private ?int $personaId = null,\n private ?string $title = null,\n private ?int $authorProfileId = null,\n private ?int $systemPromptId = null,\n private ?\\DateTimeImmutable $createdAt = null,\n private ?\\DateTimeImmutable $updatedAt = null,\n private ?\\DateTimeImmutable $lastActivity = null\n ) {\n $this->createdAt ??= new \\DateTimeImmutable();\n $this->updatedAt ??= new \\DateTimeImmutable();\n $this->lastActivity ??= new \\DateTimeImmutable();\n }\n\n public function getId(): ?int\n {\n return $this->id;\n }\n\n public function getUuid(): string\n {\n return $this->uuid->value();\n }\n\n public function getUuidObject(): SessionUuid\n {\n return $this->uuid;\n }\n\n public function getSessionToken(): ?string\n {\n return $this->sessionToken;\n }\n\n public function getUserId(): ?int\n {\n return $this->userId;\n }\n\n public function getPersonaId(): ?int\n {\n return $this->personaId;\n }\n\n public function getTitle(): ?string\n {\n return $this->title;\n }\n\n public function getModel(): string\n {\n return $this->metadata->getModel();\n }\n\n \/**\n * @return array<string>\n *\/\n public function getCollections(): array\n {\n return $this->metadata->getCollections();\n }\n\n public function getContextLimit(): int\n {\n return $this->metadata->getContextLimit();\n }\n\n public function getTemperature(): float\n {\n return $this->metadata->getTemperature();\n }\n\n public function getMaxTokens(): int\n {\n return $this->metadata->getMaxTokens();\n }\n\n public function getAuthorProfileId(): ?int\n {\n return $this->authorProfileId;\n }\n\n public function getSystemPromptId(): ?int\n {\n return $this->systemPromptId;\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 public function getLastActivity(): \\DateTimeImmutable\n {\n return $this->lastActivity;\n }\n\n \/\/ Setters with fluent interface\n public function setId(int $id): self\n {\n $this->id = $id;\n\n return $this;\n }\n\n public function setUuid(string $uuid): self\n {\n $this->uuid = SessionUuid::fromString($uuid);\n\n return $this;\n }\n\n public function setSessionToken(?string $sessionToken): self\n {\n $this->sessionToken = $sessionToken;\n\n return $this;\n }\n\n public function setUserId(?int $userId): self\n {\n $this->userId = $userId;\n\n return $this;\n }\n\n public function setPersonaId(?int $personaId): self\n {\n $this->personaId = $personaId;\n\n return $this;\n }\n\n public function setTitle(?string $title): self\n {\n $this->title = $title;\n $this->touch();\n\n return $this;\n }\n\n public function setModel(string $model): self\n {\n $this->model = $model;\n $this->touch();\n\n return $this;\n }\n\n \/**\n * @param array<string> $collections\n *\/\n public function setCollections(array $collections): self\n {\n $this->collections = $collections;\n $this->touch();\n\n return $this;\n }\n\n public function setContextLimit(int $contextLimit): self\n {\n $this->contextLimit = $contextLimit;\n $this->touch();\n\n return $this;\n }\n\n public function setTemperature(float $temperature): self\n {\n $this->temperature = $temperature;\n $this->touch();\n\n return $this;\n }\n\n public function setMaxTokens(int $maxTokens): self\n {\n $this->maxTokens = $maxTokens;\n $this->touch();\n\n return $this;\n }\n\n public function setAuthorProfileId(?int $authorProfileId): self\n {\n $this->authorProfileId = $authorProfileId;\n $this->touch();\n\n return $this;\n }\n\n public function setSystemPromptId(?int $systemPromptId): self\n {\n $this->systemPromptId = $systemPromptId;\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 public function setLastActivity(\\DateTimeImmutable $lastActivity): self\n {\n $this->lastActivity = $lastActivity;\n\n return $this;\n }\n\n \/**\n * Update timestamps on modification.\n *\/\n private function touch(): void\n {\n $this->updatedAt = new \\DateTimeImmutable();\n $this->lastActivity = new \\DateTimeImmutable();\n }\n\n \/**\n * Factory method for creating a new session.\n *\n * @param string|SessionUuid $uuid\n * @param array<string> $collections\n *\/\n public static function create(\n string|SessionUuid $uuid,\n string $model = 'claude-opus-4-5-20251101',\n array $collections = ['documents'],\n int $contextLimit = 5\n ): self {\n $session = new self();\n $session->uuid = $uuid instanceof SessionUuid ? $uuid : SessionUuid::fromString($uuid);\n $session->model = $model;\n $session->collections = $collections;\n $session->contextLimit = $contextLimit;\n\n return $session;\n }\n\n \/**\n * Create a copy with new ID (for post-save).\n *\/\n public function withId(int $id): self\n {\n $clone = clone $this;\n $clone->id = $id;\n\n return $clone;\n }\n\n \/**\n * Update settings in one call.\n *\/\n public function updateSettings(\n string $model,\n array $collections,\n int $contextLimit,\n ?int $authorProfileId,\n float $temperature,\n int $maxTokens\n ): self {\n $this->model = $model;\n $this->collections = $collections;\n $this->contextLimit = $contextLimit;\n $this->authorProfileId = $authorProfileId;\n $this->temperature = $temperature;\n $this->maxTokens = $maxTokens;\n $this->touch();\n\n return $this;\n }\n\n \/**\n * Convert to array for persistence.\n *\n * @return array<string, mixed>\n *\/\n public function toArray(): array\n {\n return [\n 'id' => $this->id,\n 'uuid' => $this->uuid->value(),\n 'session_token' => $this->sessionToken,\n 'user_id' => $this->userId,\n 'persona_id' => $this->personaId,\n 'title' => $this->title,\n 'model' => $this->model,\n 'collections' => json_encode($this->collections),\n 'context_limit' => $this->contextLimit,\n 'temperature' => $this->temperature,\n 'max_tokens' => $this->maxTokens,\n 'author_profile_id' => $this->authorProfileId,\n 'system_prompt_id' => $this->systemPromptId,\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 'last_activity' => $this->lastActivity->format('Y-m-d H:i:s'),\n ];\n }\n\n \/**\n * Create from database row.\n *\n * @param array<string, mixed> $data\n *\/\n public static function fromArray(array $data): self\n {\n $session = new self();\n\n if (isset($data['id'])) {\n $session->setId((int) $data['id']);\n }\n if (isset($data['uuid'])) {\n $session->setUuid($data['uuid']);\n }\n if (isset($data['session_token'])) {\n $session->setSessionToken($data['session_token']);\n }\n if (isset($data['user_id'])) {\n $session->setUserId((int) $data['user_id']);\n }\n if (isset($data['persona_id'])) {\n $session->setPersonaId((int) $data['persona_id']);\n }\n if (isset($data['title'])) {\n $session->title = $data['title'];\n }\n if (isset($data['model'])) {\n $session->model = $data['model'];\n }\n if (isset($data['collections'])) {\n $collections = is_string($data['collections'])\n ? json_decode($data['collections'], true)\n : $data['collections'];\n $session->collections = is_array($collections) ? $collections : ['documents'];\n }\n if (isset($data['context_limit'])) {\n $session->contextLimit = (int) $data['context_limit'];\n }\n if (isset($data['temperature'])) {\n $session->temperature = (float) $data['temperature'];\n }\n if (isset($data['max_tokens'])) {\n $session->maxTokens = (int) $data['max_tokens'];\n }\n if (isset($data['author_profile_id'])) {\n $session->authorProfileId = (int) $data['author_profile_id'];\n }\n if (isset($data['system_prompt_id'])) {\n $session->systemPromptId = (int) $data['system_prompt_id'];\n }\n if (isset($data['created_at'])) {\n $session->createdAt = new \\DateTimeImmutable($data['created_at']);\n }\n if (isset($data['updated_at'])) {\n $session->updatedAt = new \\DateTimeImmutable($data['updated_at']);\n }\n if (isset($data['last_activity'])) {\n $session->lastActivity = new \\DateTimeImmutable($data['last_activity']);\n }\n\n return $session;\n }\n}\n",
"structuredPatch": [
{
"oldStart": 118,
"oldLines": 174,
"newStart": 118,
"newLines": 42,
"lines": [
" return $this->lastActivity;",
" }",
" ",
"- \/\/ Setters with fluent interface",
"- public function setId(int $id): self",
"+ public function withId(int $id): self",
" {",
"- $this->id = $id;",
"-",
"- return $this;",
"+ return new self(",
"+ uuid: $this->uuid,",
"+ metadata: $this->metadata,",
"+ id: $id,",
"+ sessionToken: $this->sessionToken,",
"+ userId: $this->userId,",
"+ personaId: $this->personaId,",
"+ title: $this->title,",
"+ authorProfileId: $this->authorProfileId,",
"+ systemPromptId: $this->systemPromptId,",
"+ createdAt: $this->createdAt,",
"+ updatedAt: $this->updatedAt,",
"+ lastActivity: $this->lastActivity",
"+ );",
" }",
" ",
"- public function setUuid(string $uuid): self",
"+ public function withTitle(string $title): self",
" {",
"- $this->uuid = SessionUuid::fromString($uuid);",
"-",
"- return $this;",
"+ return new self(",
"+ uuid: $this->uuid,",
"+ metadata: $this->metadata,",
"+ id: $this->id,",
"+ sessionToken: $this->sessionToken,",
"+ userId: $this->userId,",
"+ personaId: $this->personaId,",
"+ title: $title,",
"+ authorProfileId: $this->authorProfileId,",
"+ systemPromptId: $this->systemPromptId,",
"+ createdAt: $this->createdAt,",
"+ updatedAt: new \\DateTimeImmutable(),",
"+ lastActivity: new \\DateTimeImmutable()",
"+ );",
" }",
" ",
"- public function setSessionToken(?string $sessionToken): self",
"- {",
"- $this->sessionToken = $sessionToken;",
"-",
"- return $this;",
"- }",
"-",
"- public function setUserId(?int $userId): self",
"- {",
"- $this->userId = $userId;",
"-",
"- return $this;",
"- }",
"-",
"- public function setPersonaId(?int $personaId): self",
"- {",
"- $this->personaId = $personaId;",
"-",
"- return $this;",
"- }",
"-",
"- public function setTitle(?string $title): self",
"- {",
"- $this->title = $title;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setModel(string $model): self",
"- {",
"- $this->model = $model;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- \/**",
"- * @param array<string> $collections",
"- *\/",
"- public function setCollections(array $collections): self",
"- {",
"- $this->collections = $collections;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setContextLimit(int $contextLimit): self",
"- {",
"- $this->contextLimit = $contextLimit;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setTemperature(float $temperature): self",
"- {",
"- $this->temperature = $temperature;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setMaxTokens(int $maxTokens): self",
"- {",
"- $this->maxTokens = $maxTokens;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setAuthorProfileId(?int $authorProfileId): self",
"- {",
"- $this->authorProfileId = $authorProfileId;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setSystemPromptId(?int $systemPromptId): self",
"- {",
"- $this->systemPromptId = $systemPromptId;",
"- $this->touch();",
"-",
"- return $this;",
"- }",
"-",
"- public function setCreatedAt(\\DateTimeImmutable $createdAt): self",
"- {",
"- $this->createdAt = $createdAt;",
"-",
"- return $this;",
"- }",
"-",
"- public function setUpdatedAt(\\DateTimeImmutable $updatedAt): self",
"- {",
"- $this->updatedAt = $updatedAt;",
"-",
"- return $this;",
"- }",
"-",
"- public function setLastActivity(\\DateTimeImmutable $lastActivity): self",
"- {",
"- $this->lastActivity = $lastActivity;",
"-",
"- return $this;",
"- }",
"-",
"- \/**",
"- * Update timestamps on modification.",
"- *\/",
"- private function touch(): void",
"- {",
"- $this->updatedAt = new \\DateTimeImmutable();",
"- $this->lastActivity = new \\DateTimeImmutable();",
"- }",
"-",
"- \/**",
"- * Factory method for creating a new session.",
"- *",
"- * @param string|SessionUuid $uuid",
"- * @param array<string> $collections",
"- *\/",
"- public static function create(",
"- string|SessionUuid $uuid,",
"- string $model = 'claude-opus-4-5-20251101',",
"- array $collections = ['documents'],",
"- int $contextLimit = 5",
"- ): self {",
"- $session = new self();",
"- $session->uuid = $uuid instanceof SessionUuid ? $uuid : SessionUuid::fromString($uuid);",
"- $session->model = $model;",
"- $session->collections = $collections;",
"- $session->contextLimit = $contextLimit;",
"-",
"- return $session;",
"- }",
"-",
"- \/**",
"- * Create a copy with new ID (for post-save).",
"- *\/",
"- public function withId(int $id): self",
"- {",
"- $clone = clone $this;",
"- $clone->id = $id;",
"-",
"- return $clone;",
"- }",
"-",
"- \/**",
"- * Update settings in one call.",
"- *\/",
" public function updateSettings(",
" string $model,",
" array $collections,"
]
},
{
"oldStart": 294,
"oldLines": 15,
"newStart": 162,
"newLines": 28,
"lines": [
" float $temperature,",
" int $maxTokens",
" ): self {",
"- $this->model = $model;",
"- $this->collections = $collections;",
"- $this->contextLimit = $contextLimit;",
"- $this->authorProfileId = $authorProfileId;",
"- $this->temperature = $temperature;",
"- $this->maxTokens = $maxTokens;",
"- $this->touch();",
"+ $newMetadata = SessionMetadata::create(",
"+ model: $model,",
"+ collections: $collections,",
"+ contextLimit: $contextLimit,",
"+ temperature: $temperature,",
"+ maxTokens: $maxTokens",
"+ );",
" ",
"- return $this;",
"+ return new self(",
"+ uuid: $this->uuid,",
"+ metadata: $newMetadata,",
"+ id: $this->id,",
"+ sessionToken: $this->sessionToken,",
"+ userId: $this->userId,",
"+ personaId: $this->personaId,",
"+ title: $this->title,",
"+ authorProfileId: $authorProfileId,",
"+ systemPromptId: $this->systemPromptId,",
"+ createdAt: $this->createdAt,",
"+ updatedAt: new \\DateTimeImmutable(),",
"+ lastActivity: new \\DateTimeImmutable()",
"+ );",
" }",
" ",
" \/**"
]
}
],
"userModified": false,
"replaceAll": false
}
}