asdsad
This commit is contained in:
@@ -3,19 +3,18 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
// 1. Autoloader für App Namespace
|
// 1. Autoloader für App Namespace
|
||||||
spl_autoload_register(function ($class) {
|
spl_autoload_register(function ($class) {
|
||||||
|
// 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\\';
|
$prefix = 'App\\';
|
||||||
$base_dir = __DIR__ . '/../src/App/';
|
$base_dir = __DIR__ . '/../src/App/';
|
||||||
|
|
||||||
$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 {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
$len = strlen($prefix);
|
||||||
|
|
||||||
$relative_class = substr($class, $len);
|
$relative_class = substr($class, $len);
|
||||||
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
|
||||||
|
|||||||
Reference in New Issue
Block a user