Backup #1227
| ID | 1227 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/services.php |
| Version | 61 |
| Typ |
modified |
| Größe | 14.3 KB |
| Hash | 7dfa5078693105afb6119577f002e48476d9cb6931a475181b9477c60af5ccb9 |
| Datum | 2025-12-25 12:31:38 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
/**
* Service Definitions for DI Container.
*
* All repositories and services are explicitly registered to ensure
* proper database connections and avoid instantiation in controllers.
*
* @param Framework\Container $container
*/
use Application\ContentCollectionService;
use Application\PipelineStepService;
use Domain\Repository\ChatMessageRepositoryInterface;
use Domain\Repository\ChatSessionRepositoryInterface;
use Domain\Repository\ChunkRepositoryInterface;
use Domain\Repository\CodeAnalysisRepositoryInterface;
use Domain\Repository\CollectionRepositoryInterface;
use Domain\Repository\ContentRepositoryInterface;
use Domain\Repository\DocumentRepositoryInterface;
use Domain\Repository\DokumentationRepositoryInterface;
use Domain\Repository\EntityRepositoryInterface;
use Domain\Repository\OntologyRepositoryInterface;
use Domain\Repository\PipelineRepositoryInterface;
use Domain\Repository\RelationRepositoryInterface;
use Domain\Repository\SemanticSearchRepositoryInterface;
use Domain\Repository\TaskRepositoryInterface;
use Domain\Repository\TaxonomyRepositoryInterface;
use Domain\Service\CodeScannerInterface;
use Framework\Container;
use Infrastructure\AI\AIConfig;
use Infrastructure\AI\ChatService;
use Infrastructure\AI\ContentQualityValidator;
use Infrastructure\AI\ModelRegistry;
use Infrastructure\AI\OllamaService;
use Infrastructure\AI\QdrantService;
use Infrastructure\AI\VectorSearchService;
use Infrastructure\CodeAnalysis\CodeQualityChecker;
use Infrastructure\CodeAnalysis\CodeScanner;
use Infrastructure\CodeAnalysis\JsFileParser;
use Infrastructure\CodeAnalysis\PhpFileParser;
use Infrastructure\CodeAnalysis\PythonFileParser;
use Infrastructure\Config\DatabaseFactory;
use Infrastructure\Docs\ChunkAnalysisService;
use Infrastructure\Docs\ChunkingService;
use Infrastructure\Docs\ChunkSyncService;
use Infrastructure\Docs\HybridSearchService;
use Infrastructure\Formatter\ApiResponseFormatter;
use Infrastructure\Formatting\ChatMessageFormatter;
use Infrastructure\Logging\AuditLogger;
use Infrastructure\Persistence\ChatMessageRepository;
use Infrastructure\Persistence\ChatSessionRepository;
use Infrastructure\Persistence\ChunkRepository;
use Infrastructure\Persistence\CodeAnalysisRepository;
use Infrastructure\Persistence\CollectionRepository;
use Infrastructure\Persistence\ContentConfigRepository;
use Infrastructure\Persistence\ContentRepository;
use Infrastructure\Persistence\ContractRepository;
use Infrastructure\Persistence\CriticsRepository;
use Infrastructure\Persistence\DocumentRepository;
use Infrastructure\Persistence\DokumentationRepository;
use Infrastructure\Persistence\EntityRepository;
use Infrastructure\Persistence\FileBackupRepository;
use Infrastructure\Persistence\KiProtokollRepository;
use Infrastructure\Persistence\OntologyRepository;
use Infrastructure\Persistence\PipelineRepository;
use Infrastructure\Persistence\PromptsRepository;
use Infrastructure\Persistence\RelationRepository;
use Infrastructure\Persistence\SemanticSearchRepository;
use Infrastructure\Persistence\SystemExplorerRepository;
use Infrastructure\Persistence\TaskAssignmentRepository;
use Infrastructure\Persistence\TaskCommentRepository;
use Infrastructure\Persistence\TaskRepository;
use Infrastructure\Persistence\TaskResultRepository;
use Infrastructure\Persistence\TaxonomyRepository;
use Infrastructure\Validation\CollectionValidator;
// NOTE: UseCases are NOT explicitly registered here.
// They are resolved via Container::autowire() automatically.
// Only register: Interfaces, Services with special config, Repositories.
return function (Container $container): void {
// =========================================================================
// DATABASE CONNECTIONS
// =========================================================================
// ki_dev database connection
$container->set('pdo.dev', fn () => DatabaseFactory::dev());
// ki_content database connection
$container->set('pdo.content', fn () => DatabaseFactory::content());
// =========================================================================
// REPOSITORIES - ki_dev database
// =========================================================================
$container->set(SystemExplorerRepository::class, fn (Container $c) => new SystemExplorerRepository($c->get('pdo.dev')));
$container->set(DokumentationRepository::class, fn (Container $c) => new DokumentationRepository($c->get('pdo.dev')));
$container->set(FileBackupRepository::class, fn (Container $c) => new FileBackupRepository($c->get('pdo.dev')));
$container->set(ContractRepository::class, fn (Container $c) => new ContractRepository($c->get('pdo.dev')));
$container->set(TaskRepository::class, fn (Container $c) => new TaskRepository($c->get('pdo.dev')));
$container->set(TaskAssignmentRepository::class, fn (Container $c) => new TaskAssignmentRepository($c->get('pdo.dev')));
$container->set(TaskResultRepository::class, fn (Container $c) => new TaskResultRepository($c->get('pdo.dev')));
$container->set(TaskCommentRepository::class, fn (Container $c) => new TaskCommentRepository($c->get('pdo.dev')));
$container->set(KiProtokollRepository::class, fn (Container $c) => new KiProtokollRepository($c->get('pdo.dev')));
$container->set(CollectionRepository::class, fn (Container $c) => new CollectionRepository($c->get('pdo.dev'), $c->get('pdo.content')));
$container->set(CodeAnalysisRepository::class, fn (Container $c) => new CodeAnalysisRepository($c->get('pdo.dev')));
// =========================================================================
// REPOSITORIES - ki_content database
// =========================================================================
$container->set(PipelineRepository::class, fn (Container $c) => new PipelineRepository($c->get('pdo.content')));
$container->set(ContentRepository::class, fn (Container $c) => new ContentRepository($c->get('pdo.content')));
$container->set(TaxonomyRepository::class, fn (Container $c) => new TaxonomyRepository($c->get('pdo.content')));
$container->set(OntologyRepository::class, fn (Container $c) => new OntologyRepository($c->get('pdo.content')));
$container->set(DocumentRepository::class, fn (Container $c) => new DocumentRepository($c->get('pdo.content')));
$container->set(ChunkRepository::class, fn (Container $c) => new ChunkRepository($c->get('pdo.content')));
$container->set(RelationRepository::class, fn (Container $c) => new RelationRepository($c->get('pdo.content')));
$container->set(EntityRepository::class, fn (Container $c) => new EntityRepository($c->get('pdo.content')));
$container->set(SemanticSearchRepository::class, fn (Container $c) => new SemanticSearchRepository($c->get('pdo.content')));
$container->set(ChatSessionRepository::class, fn (Container $c) => new ChatSessionRepository($c->get('pdo.content')));
$container->set(ChatMessageRepository::class, fn (Container $c) => new ChatMessageRepository($c->get('pdo.content')));
$container->set(PromptsRepository::class, fn (Container $c) => new PromptsRepository($c->get('pdo.content')));
$container->set(CriticsRepository::class, fn (Container $c) => new CriticsRepository($c->get('pdo.content')));
$container->set(ContentConfigRepository::class, fn (Container $c) => new ContentConfigRepository($c->get('pdo.content')));
// =========================================================================
// INTERFACE ALIASES (Domain → Infrastructure)
// =========================================================================
$container->set(TaskRepositoryInterface::class, fn (Container $c) => $c->get(TaskRepository::class));
$container->set(ChatSessionRepositoryInterface::class, fn (Container $c) => $c->get(ChatSessionRepository::class));
$container->set(ChatMessageRepositoryInterface::class, fn (Container $c) => $c->get(ChatMessageRepository::class));
$container->set(CollectionRepositoryInterface::class, fn (Container $c) => $c->get(CollectionRepository::class));
$container->set(PipelineRepositoryInterface::class, fn (Container $c) => $c->get(PipelineRepository::class));
$container->set(ContentRepositoryInterface::class, fn (Container $c) => $c->get(ContentRepository::class));
$container->set(DokumentationRepositoryInterface::class, fn (Container $c) => $c->get(DokumentationRepository::class));
$container->set(CodeAnalysisRepositoryInterface::class, fn (Container $c) => $c->get(CodeAnalysisRepository::class));
$container->set(TaxonomyRepositoryInterface::class, fn (Container $c) => $c->get(TaxonomyRepository::class));
$container->set(OntologyRepositoryInterface::class, fn (Container $c) => $c->get(OntologyRepository::class));
$container->set(DocumentRepositoryInterface::class, fn (Container $c) => $c->get(DocumentRepository::class));
$container->set(ChunkRepositoryInterface::class, fn (Container $c) => $c->get(ChunkRepository::class));
$container->set(RelationRepositoryInterface::class, fn (Container $c) => $c->get(RelationRepository::class));
$container->set(EntityRepositoryInterface::class, fn (Container $c) => $c->get(EntityRepository::class));
$container->set(SemanticSearchRepositoryInterface::class, fn (Container $c) => $c->get(SemanticSearchRepository::class));
// =========================================================================
// CODE ANALYSIS SERVICES
// =========================================================================
$container->set(PhpFileParser::class, fn () => new PhpFileParser());
$container->set(PythonFileParser::class, fn () => new PythonFileParser());
$container->set(JsFileParser::class, fn () => new JsFileParser());
$container->set(CodeQualityChecker::class, fn () => new CodeQualityChecker());
$container->set(CodeScanner::class, function (Container $c) {
return new CodeScanner(
$c->get(CodeAnalysisRepository::class),
$c->get(PhpFileParser::class),
$c->get(PythonFileParser::class),
$c->get(JsFileParser::class),
$c->get(CodeQualityChecker::class)
);
});
$container->set(CodeScannerInterface::class, fn (Container $c) => $c->get(CodeScanner::class));
// =========================================================================
// AI SERVICES
// =========================================================================
$container->set(AIConfig::class, fn () => AIConfig::fromCredentialsFile());
$container->set(ChatService::class, function (Container $c) {
return $c->get(AIConfig::class)->createChatService();
});
$container->set(OllamaService::class, function (Container $c) {
return $c->get(AIConfig::class)->createOllamaService();
});
$container->set(QdrantService::class, function (Container $c) {
return $c->get(AIConfig::class)->createQdrantService();
});
$container->set(VectorSearchService::class, fn () => new VectorSearchService());
$container->set(ContentQualityValidator::class, function (Container $c) {
return new ContentQualityValidator($c->get(OllamaService::class));
});
$container->set(ModelRegistry::class, function (Container $c) {
$registry = new ModelRegistry($c->get('pdo.dev'));
ModelRegistry::setInstance($registry);
return $registry;
});
// =========================================================================
// APPLICATION SERVICES
// =========================================================================
$container->set(AuditLogger::class, fn (Container $c) => new AuditLogger($c->get('pdo.dev')));
$container->set(Infrastructure\Audit\AuditService::class, function (Container $c) {
return new Infrastructure\Audit\AuditService($c->get('pdo.dev'));
});
$container->set(ChunkSyncService::class, function (Container $c) {
return new ChunkSyncService(
$c->get('pdo.dev'),
$c->get(OllamaService::class)
);
});
$container->set(HybridSearchService::class, function (Container $c) {
return new HybridSearchService(
$c->get('pdo.dev'),
$c->get(OllamaService::class)
);
});
$container->set(ChunkAnalysisService::class, function (Container $c) {
return new ChunkAnalysisService(
$c->get('pdo.dev'),
$c->get(OllamaService::class)
);
});
$container->set(ChunkingService::class, function (Container $c) {
return new ChunkingService(
$c->get('pdo.dev'),
$c->get(DokumentationRepository::class)
);
});
$container->set(CollectionValidator::class, function (Container $c) {
return new CollectionValidator($c->get(CollectionRepository::class));
});
$container->set(ContentCollectionService::class, function (Container $c) {
return new ContentCollectionService(
$c->get(CollectionRepository::class),
$c->get(CollectionValidator::class)
);
});
$container->set(PipelineStepService::class, function (Container $c) {
return new PipelineStepService($c->get(PipelineRepository::class));
});
// =========================================================================
// FORMATTERS
// =========================================================================
$container->set(ApiResponseFormatter::class, fn () => new ApiResponseFormatter());
$container->set(ChatMessageFormatter::class, fn () => new ChatMessageFormatter());
// =========================================================================
// USE CASES - Explicit registrations for PDO dependencies
// =========================================================================
// UseCases that need specific PDO connections must be registered explicitly.
// Other UseCases are resolved via Container::autowire() automatically.
$container->set(\UseCases\Chat\ManageChatSessionsUseCase::class, function (Container $c) {
return new \UseCases\Chat\ManageChatSessionsUseCase(
$c->get(ChatSessionRepositoryInterface::class),
$c->get(ChatMessageRepositoryInterface::class),
$c->get(ContentConfigRepository::class),
$c->get(CollectionRepositoryInterface::class),
$c->get(CollectionValidator::class),
$c->get('pdo.dev')
);
});
};
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 1446 |
93 |
modified |
20.7 KB |
2025-12-25 17:00 |
| 1444 |
92 |
modified |
20.6 KB |
2025-12-25 17:00 |
| 1437 |
91 |
modified |
20.2 KB |
2025-12-25 16:59 |
| 1435 |
90 |
modified |
19.7 KB |
2025-12-25 16:59 |
| 1434 |
89 |
modified |
19.5 KB |
2025-12-25 16:59 |
| 1432 |
88 |
modified |
19.3 KB |
2025-12-25 16:59 |
| 1428 |
87 |
modified |
19.2 KB |
2025-12-25 16:59 |
| 1423 |
86 |
modified |
18.8 KB |
2025-12-25 16:59 |
| 1417 |
85 |
modified |
18.7 KB |
2025-12-25 16:59 |
| 1411 |
84 |
modified |
18.3 KB |
2025-12-25 16:58 |
| 1408 |
83 |
modified |
17.9 KB |
2025-12-25 16:58 |
| 1404 |
82 |
modified |
17.8 KB |
2025-12-25 16:58 |
| 1402 |
81 |
modified |
17.6 KB |
2025-12-25 16:58 |
| 1307 |
80 |
modified |
17.6 KB |
2025-12-25 13:31 |
| 1306 |
79 |
modified |
17.5 KB |
2025-12-25 13:31 |
| 1288 |
78 |
modified |
17.2 KB |
2025-12-25 13:02 |
| 1287 |
77 |
modified |
17.1 KB |
2025-12-25 13:02 |
| 1286 |
76 |
modified |
17.1 KB |
2025-12-25 13:02 |
| 1278 |
75 |
modified |
16.3 KB |
2025-12-25 12:53 |
| 1277 |
74 |
modified |
15.9 KB |
2025-12-25 12:53 |
| 1259 |
73 |
modified |
16.0 KB |
2025-12-25 12:46 |
| 1258 |
72 |
modified |
16.2 KB |
2025-12-25 12:46 |
| 1257 |
71 |
modified |
16.2 KB |
2025-12-25 12:46 |
| 1256 |
70 |
modified |
16.3 KB |
2025-12-25 12:46 |
| 1253 |
69 |
modified |
16.2 KB |
2025-12-25 12:45 |
| 1252 |
68 |
modified |
15.8 KB |
2025-12-25 12:45 |
| 1251 |
67 |
modified |
15.5 KB |
2025-12-25 12:45 |
| 1250 |
66 |
modified |
15.3 KB |
2025-12-25 12:45 |
| 1249 |
65 |
modified |
15.1 KB |
2025-12-25 12:45 |
| 1230 |
64 |
modified |
14.8 KB |
2025-12-25 12:31 |
| 1229 |
63 |
modified |
14.5 KB |
2025-12-25 12:31 |
| 1228 |
62 |
modified |
14.4 KB |
2025-12-25 12:31 |
| 1227 |
61 |
modified |
14.3 KB |
2025-12-25 12:31 |
| 1216 |
60 |
modified |
13.9 KB |
2025-12-25 10:41 |
| 1213 |
59 |
modified |
13.9 KB |
2025-12-25 10:40 |
| 1212 |
58 |
modified |
13.8 KB |
2025-12-25 10:40 |
| 1209 |
57 |
modified |
13.5 KB |
2025-12-25 10:36 |
| 1208 |
56 |
modified |
13.3 KB |
2025-12-25 10:36 |
| 1171 |
55 |
modified |
13.1 KB |
2025-12-25 10:29 |
| 1112 |
54 |
modified |
12.9 KB |
2025-12-25 09:23 |
| 1111 |
53 |
modified |
12.8 KB |
2025-12-25 09:23 |
| 1110 |
52 |
modified |
12.9 KB |
2025-12-25 09:23 |
| 1109 |
51 |
modified |
12.9 KB |
2025-12-25 09:23 |
| 1108 |
50 |
modified |
12.9 KB |
2025-12-25 09:23 |
| 1103 |
49 |
modified |
12.8 KB |
2025-12-25 09:20 |
| 1102 |
48 |
modified |
12.7 KB |
2025-12-25 09:20 |
| 1101 |
47 |
modified |
12.6 KB |
2025-12-25 09:20 |
| 1100 |
46 |
modified |
12.6 KB |
2025-12-25 09:20 |
| 1086 |
45 |
modified |
12.5 KB |
2025-12-25 02:29 |
| 1085 |
44 |
modified |
12.4 KB |
2025-12-25 02:29 |
| 1084 |
43 |
modified |
12.3 KB |
2025-12-25 02:29 |
| 1083 |
42 |
modified |
12.3 KB |
2025-12-25 02:29 |
| 1075 |
41 |
modified |
12.1 KB |
2025-12-25 02:27 |
| 1074 |
40 |
modified |
11.9 KB |
2025-12-25 02:27 |
| 1073 |
39 |
modified |
11.8 KB |
2025-12-25 02:26 |
| 1072 |
38 |
modified |
11.7 KB |
2025-12-25 02:26 |
| 1062 |
37 |
modified |
11.6 KB |
2025-12-25 02:23 |
| 1061 |
36 |
modified |
11.5 KB |
2025-12-25 02:23 |
| 1060 |
35 |
modified |
11.5 KB |
2025-12-25 02:23 |
| 1059 |
34 |
modified |
11.4 KB |
2025-12-25 02:23 |
| 1051 |
33 |
modified |
11.3 KB |
2025-12-25 02:20 |
| 1050 |
32 |
modified |
11.2 KB |
2025-12-25 02:20 |
| 1049 |
31 |
modified |
11.2 KB |
2025-12-25 02:20 |
| 1048 |
30 |
modified |
11.1 KB |
2025-12-25 02:20 |
| 1026 |
29 |
modified |
11.0 KB |
2025-12-24 20:20 |
| 934 |
28 |
modified |
10.8 KB |
2025-12-23 21:45 |
| 933 |
27 |
modified |
10.8 KB |
2025-12-23 21:45 |
| 920 |
26 |
modified |
10.6 KB |
2025-12-23 21:05 |
| 919 |
25 |
modified |
10.5 KB |
2025-12-23 21:04 |
| 874 |
24 |
modified |
9.8 KB |
2025-12-23 09:29 |
| 873 |
23 |
modified |
9.6 KB |
2025-12-23 09:29 |
| 872 |
22 |
modified |
9.4 KB |
2025-12-23 09:29 |
| 869 |
21 |
modified |
9.2 KB |
2025-12-23 09:00 |
| 868 |
20 |
modified |
9.1 KB |
2025-12-23 09:00 |
| 867 |
19 |
modified |
8.9 KB |
2025-12-23 08:58 |
| 866 |
18 |
modified |
8.9 KB |
2025-12-23 08:58 |
| 861 |
17 |
modified |
8.1 KB |
2025-12-23 08:47 |
| 860 |
16 |
modified |
8.0 KB |
2025-12-23 08:47 |
| 850 |
15 |
modified |
12.3 KB |
2025-12-23 08:30 |
| 849 |
14 |
modified |
12.9 KB |
2025-12-23 08:30 |
| 848 |
13 |
modified |
11.7 KB |
2025-12-23 08:23 |
| 847 |
12 |
modified |
10.5 KB |
2025-12-23 08:22 |
| 846 |
11 |
modified |
10.3 KB |
2025-12-23 08:22 |
| 845 |
10 |
modified |
9.6 KB |
2025-12-23 08:22 |
| 844 |
9 |
modified |
9.3 KB |
2025-12-23 08:22 |
| 645 |
8 |
modified |
8.5 KB |
2025-12-23 04:47 |
| 644 |
7 |
modified |
8.1 KB |
2025-12-23 04:47 |
| 610 |
6 |
modified |
7.2 KB |
2025-12-23 04:41 |
| 609 |
5 |
modified |
6.8 KB |
2025-12-23 04:41 |
| 604 |
4 |
modified |
1.1 KB |
2025-12-23 04:38 |
| 584 |
3 |
modified |
1.1 KB |
2025-12-23 04:23 |
| 583 |
2 |
modified |
1.1 KB |
2025-12-23 04:23 |
| 526 |
1 |
modified |
1.0 KB |
2025-12-22 16:47 |
← Zurück zur Übersicht