Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 67dd2df

Browse files
author
Mateo Mujica
committed
autoload changes
1 parent d65c8bf commit 67dd2df

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

Particle/Core/autoload/autoload_apps.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,30 @@
1010
* Autoload de Entidades de base de datos con Spot ORM
1111
*/
1212
spl_autoload_register(function ($ClassNameWithNameSpace) {
13-
$namespace = 'Particle\Apps\Entities\\';
1413

15-
if (substr($ClassNameWithNameSpace, 0, strlen($namespace)) === $namespace) {
16-
$nameClass = substr($ClassNameWithNameSpace, strlen($namespace));
14+
$aNamespace = array('Particle\Apps\Entities\\', 'Particle\Apps\Entities\Mapper\\');
1715

18-
$filePath = PARTICLE_PATH_APPS.'Entities'.DS.$nameClass.'.php';
19-
20-
if (!is_readable($filePath)) {
21-
foreach (glob(PARTICLE_PATH_APPS.'Entities'.DS.'*', GLOB_ONLYDIR) as $dir) {
22-
$subDir= basename($dir);
23-
$filePath = PARTICLE_PATH_APPS.'Entities'.DS.$subDir.DS.$nameClass.'.php';
24-
if (is_readable($filePath)) {
25-
require_once $filePath;
26-
break;
16+
foreach ($aNamespace as $sNamespace) {
17+
if (substr($ClassNameWithNameSpace, 0, strlen($sNamespace)) === $sNamespace) {
18+
$nameClass = substr($ClassNameWithNameSpace, strlen($namespace));
19+
20+
$filePath = PARTICLE_PATH_APPS.'Entities'.DS.$nameClass.'.php';
21+
22+
if (!is_readable($filePath)) {
23+
foreach (glob(PARTICLE_PATH_APPS.'Entities'.DS.'*', GLOB_ONLYDIR) as $dir) {
24+
$subDir= basename($dir);
25+
$filePath = PARTICLE_PATH_APPS.'Entities'.DS.$subDir.DS.$nameClass.'.php';
26+
if (is_readable($filePath)) {
27+
require_once $filePath;
28+
break;
29+
}
2730
}
31+
} else {
32+
require_once $filePath;
2833
}
29-
} else {
30-
require_once $filePath;
3134
}
3235
}
36+
3337
return true;
3438
});
3539

0 commit comments

Comments
 (0)