asdsad
This commit is contained in:
@@ -3,19 +3,18 @@ declare(strict_types=1);
|
||||
|
||||
// 1. Autoloader für App Namespace
|
||||
spl_autoload_register(function ($class) {
|
||||
$prefix = 'App\\';
|
||||
$base_dir = __DIR__ . '/../src/App/';
|
||||
// Repository Namespace zuerst prüfen (liegt außerhalb von /src/App)
|
||||
if (str_starts_with($class, 'App\\Repository\\')) {
|
||||
$prefix = 'App\\Repository\\';
|
||||
$base_dir = __DIR__ . '/../src/Repository/';
|
||||
} elseif (str_starts_with($class, 'App\\')) {
|
||||
$prefix = 'App\\';
|
||||
$base_dir = __DIR__ . '/../src/App/';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
$len = strlen($prefix);
|
||||
if (strncmp($prefix, $class, $len) !== 0) {
|
||||
// Versuche Repository Namespace
|
||||
if (str_starts_with($class, 'App\\Repository\\')) {
|
||||
$base_dir = __DIR__ . '/../src/Repository/';
|
||||
$len = strlen('App\\Repository\\');
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$relative_class = substr($class, $len);
|
||||
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
||||
|
||||
Reference in New Issue
Block a user