protected function completeRepositoryAssignments()
{
foreach ($this->getAllImplementationClassNamesForInterface(RepositoryInterface::class) as $repositoryClassName) {
// need to be extra careful because this code could be called
// during a cache:flush run with corrupted reflection cache
if (!class_exists($repositoryClassName) || $this->isClassAbstract($repositoryClassName)) {
continue;
}
if (!$this->isClassAnnotatedWith($repositoryClassName, Flow\Scope::class) || $this->getClassAnnotation($repositoryClassName, Flow\Scope::class)->value !== 'singleton') {
throw new ClassSchemaConstraintViolationException('The repository "' . $repositoryClassName . '" must be of scope singleton, but it is not.', 1335790707);
}
if (defined($repositoryClassName . '::ENTITY_CLASSNAME') && isset($this->classSchemata[$repositoryClassName::ENTITY_CLASSNAME])) {
$claimedObjectType = $repositoryClassName::ENTITY_CLASSNAME;
$this->classSchemata[$claimedObjectType]->setRepositoryClassName($repositoryClassName);
}
}
foreach ($this->classSchemata as $classSchema) {
if ($classSchema instanceof ClassSchema && class_exists($classSchema->getClassName()) && $classSchema->isAggregateRoot()) {
$this->makeChildClassesAggregateRoot($classSchema);
}
}
}